On Wed, Feb 14, 2007 at 05:24:03PM +0200, Dotan Cohen wrote:
On 14/02/07, Patrick Doyle wpdster@gmail.com wrote:
In your case, where you wanted to get rid of ./mydir, I would have done: $ ls -d ./mydir $ rm -rf !$
This might just be the single most useful tip that I've seen on this list in the two years that I've been subscribed. Thanks for that!
If you like that, you'll love what happens when you hit ALT-period in bash -- it recalls and displays the value of last argument to the previous command. Subsequent uses of ALT-period recall the last argument to previous commands.
You might also find the environment variable $_ useful. It serves the same purpose as !$, but works even if you've disabled bang-expansion.