In bash, I frequently do

touch whatever.py
vim whatever.py

I want something like

touch whatever.py
vim !!

So how do I do that with a bash ! directive that eats the first word?

link|improve this question

You don't need to use touch since vim will create the file if it doesn't exist (after you :w of course). – styfle Jan 6 at 6:19
You're right, bad example. In real life I am actually doing "touchmod", which is a personal alias that touches and then chmods u+x. – Jon Rodriguez Jan 6 at 6:21
feedback

1 Answer

up vote 4 down vote accepted

!* will give you the everything in the previous command except the command itself.

!$ will give you the last parameter for the previous command.

Both should work in your example (a command with a single parameter).

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.