News for hackers. Stuff that matters.
Re:Interesting commands for the Linux shell by lozf on Thursday September 14, 2017 @07:41PM (#15253411)
!$ is not merely the last word, but the last argument - particularly handy when it's a long path. Also love the way zsh expands these with a single tab press - great for clarity or further editing.
Re:Interesting commands for the Linux shell by sethrin on Thursday September 14, 2017 @08:32PM (#15253649)
That's technically incorrect. !$ is a shortcut for !!:$, which is the last word of the previous command in history. A filename is treated as a single word, as you say. This is however distinct from the last argument, which is accessible with $_ . As an example:

  $ echo 'example' > file.txt
Here !$ would return the filename, and $_ would return 'example', which was the last argument to echo.
Re:Interesting commands for the Linux shell by lozf on Friday September 15, 2017 @05:13AM (#15255711)
wow ok, neat... gonna have to spend some time with your book, Thanks!