[kwlug-disc] my new favourite command

unsolicited unsolicited at swiz.ca
Thu Dec 2 22:26:13 EST 2010


Kyle Spaans wrote, On 12/02/2010 6:02 PM:
> 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.

I can see this as you work through a 'process'. But does argn included 
stdin / out / err tokens?

Trivial example:

sort </etc/passwd >/etc/passwd.srt
less !$

and !$ above would be /etc/passwd.srt?





More information about the kwlug-disc mailing list