Smylers Smylers at
Wed Feb 23 17:48:48 GMT 2011

David Cantrell writes:

> $ svn add lib/Hlagh/
> ...
> $ 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.

Press Alt+. twice (on Linux; might be a different modified on Macs).

Or type !-2$

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

For the final argument it's generally quicker to keep pressing Alt+.
than to count the commands.

For the rest, typing !-M:N should do it. As shortcuts you can type ^
instead of :1 and $ instead of :N for the final argument.

I very much recommend putting this in ~/.inputrc:

  $if Bash
    Space: magic-space

That way pressing Space after using a ! expansion will expand it before
you press Enter, so you can verify it's done the right thing.

Hope that helps.


More information about the mailing list