Wednesday, January 2, 2008
Accessing last argument of previous command - BASH
Last argument of the preceding command can be accessed via "!$", which is very much useful, also time saving. Some examples below:
1)
$ diff a.txt s.txt
1a2
> BASH BASH BASH
#This will "cat" the s.txt file
$ cat !$
cat s.txt
Nothing rocks than BASH
BASH BASH BASH
Nothing rocks than BASH
2)
$ vi /usr/local/api/snap.log
$ tail -f !$
tail -f /usr/local/api/snap.log
...
...
Subscribe to:
Post Comments (Atom)
© Jadu Saikia www.UNIXCL.com
No comments:
Post a Comment