[kwlug-disc] my new favourite command
opengeometry at yahoo.ca
Fri Dec 3 11:41:34 EST 2010
On Thu, Dec 02, 2010 at 06:02:55PM -0500, Kyle Spaans wrote:
> On Thu, Dec 2, 2010 at 3:36 PM, Chris Frey <cdfrey at foursquare.net> wrote:
> > What other new commands have people learned lately?
> Not a command per se, but more a Bash (or possibly most shells) feature:
> $ mkdir foo
> $ cd !$
> This is a common way I use it. The "!$" is the last token of the previous
> command that you issued. So if you ever have commands of the form
> $ cmd1 arg1 arg2 ... argn
> $ cmd2 argn
> the !$ is useful.
Yes, that's a Csh feature implemented in Readline (Bash has its own
Readline) It's bound to <M-.> and <M-_> for Emacs-mode, and to <_> for
Vi-mode. You can re-bind it from ~/.inputrc. For example, since I use
Vi-mode exclusively, I use <C-E> for that:
set keymap vi-insert
So, in "insert" mode, <C-E> will pull the last arg of the previous
command. Or, when in "command" mode, the standard <_> will do the same.
More information about the kwlug-disc_kwlug.org