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?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityIn 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?
!*
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).
touch
since vim will create the file if it doesn't exist (after you :w of course). – styfle Jan 6 '12 at 6:19