JosephSmith47
JosephSmith47

Reputation: 411

simple way of substitute last arg using history cmd

e.g.,

/usr/local/apache2/bin/apachectl args1 args2 args3 restart

/usr/local/apache2/bin/apachectl args1 args2 args3 stop

What I can think of is !!:2-4 stop, but this needs to count index explicitly, is there any better solution?

Upvotes: 1

Views: 32

Answers (1)

pacholik
pacholik

Reputation: 8972

This seems to be enough

!!:- stop

!!:2- Gets all the arguments starting from 2nd argument (except the last argument).

(link)

Upvotes: 1

Related Questions