Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|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 '12 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. –  AlcubierreDrive Jan 6 '12 at 6:21

1 Answer 1

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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