$_

Steven W. Orr steveo at syslang.net
Tue Jan 9 09:43:27 EST 2007


On Tuesday, Jan 9th 2007 at 00:03 -0500, quoth aluminumsulfate at earthlink.net:

=>
=>Yeah, I know, it's a great subject line. :)
=>
=>But $_ is just SO handy!
=>
=>$ play voicemail1234.wav
=>$ rm $_
=>$ cp myfile1 /some/path
=>$ less $_/myfile2
=>
=>At the command line, $_ expands to the last argument to the previous
=>command.  And, with tab completion, you can even see and edit it!
=>
=>If y'all haven't tried $_ yet, you should definitely give it a spin!

In terms of good practices, (assuming you're using bash) I prefer using !$

!$ is the last argument of the last command. It's from the csh history 
functionality that is part of bash. See the bash man page under HISTORY 
EXPANSION. Things like !-2, !!, $-2:$, etc are all together more flexible.

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net


More information about the gnhlug-discuss mailing list