Playing around with arguments
While writing shell scripts, we often need to use different arguments passed along with the command. Here is a simple tip to display the argument of the last command.
Use ‘!!:n’ to select the nth argument of the last command, and ‘!$’ for the last argument.
dev@home$ echo a b c d
abcd
dev@home$ echo !$
echo d
d
dev@home$ echo a b c d
abcd
dev@home$ echo !!:3 echo c c
—Shivam Kotwalia, shivamkotwalia@gmail.com