Shell-fu

Matt Lawrence matt.lawrence at virgin.net
Wed Feb 23 17:40:40 GMT 2011


David Cantrell wrote:
> $ 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.
>
> And in the general case, what gives me the Nth argument from the command
> M steps back in my history?
>
>   
vi !-2:$

That's the last argument on the line two steps back

consider also:

vi !-2:2*

The 2nd to the last arguments on the same line

svn add file1 file2 file3
svn commit
vi !-2:2*

One handy thing I only learnt recently is Ctrl+Alt+e to expand those 
things in place, but it has a nasty habit of removing quotes from things 
too..

Matt



More information about the london.pm mailing list