Shell-fu

Marco Fontani fontani at gmail.com
Wed Feb 23 17:32:51 GMT 2011


> $ svn add lib/Hlagh/Blagh.pm
> ...
> $ svn commit
> ...
> $ vi !($^*%*$
>
> What line-noise should I type to get the last argument to the command
> two steps back in my history?  Obviously I only care about bash.

vi !-2$

$ vi test.txt
$ echo  svn commit
svn commit
$ vi !-2$
vi test.txt

man bash
search for HISTORY EXPANSION, all caps.

> And in the general case, what gives me the Nth argument from the command
> M steps back in my history?

!-M:N

Example:

$ vi a b c d
4 files to edit
$ echo test
test
$ vi !-2:3
vi c

Hope this helps
-marco-

-- 
Marco Fontani
Glasgow Perl Mongers - http://glasgow.pm.org/
Join the RackSpace Cloud at: http://www.rackspacecloud.com/277.html



More information about the london.pm mailing list