Equivalent of bash !! that ignores first word

2

1

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?

AlcubierreDrive

Posted 2012-01-06T06:08:50.300

Reputation: 357

You don't need to use touch since vim will create the file if it doesn't exist (after you :w of course). – styfle – 2012-01-06T06:19:05.893

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 – 2012-01-06T06:21:45.763

Answers

4

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

Ash

Posted 2012-01-06T06:08:50.300

Reputation: 2 574