Shell-fu

Ash Berlin ash_cpan at firemirror.com
Wed Feb 23 17:40:05 GMT 2011


On 23 Feb 2011, at 17:32, Marco Fontani 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.
> 
> 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-


The other options is to hit alt+. to cycle through the last argument to previous commands


More information about the london.pm mailing list