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.

How do I do a bang command to repeat last line, but with changed last argument?

share|improve this question
    
geekology.co.za/blog/2009/02/… –  joe Oct 2 '09 at 13:25
    
I guess there are other uses than just ease of typing, but <Up> <Home> "sudo " <Enter> is as many key presses as "sudo !!" <Enter> (even fewer if one counts the <Shift> to get !), and more general. Similar combinations also nullifies other uses of the !! operator, in my experience. –  Daniel Andersson Mar 26 '12 at 15:10

1 Answer 1

up vote 5 down vote accepted

Try:

!!:0- new_last_argument

See this article for an overview.

share|improve this answer
    
I couldn't tell from the article whether that was substituting or appending new_last_argument for old_last_argument. At the bottom of the link there's a cheat sheet that spells it out. Good reference! –  quack quixote Oct 2 '09 at 14:15

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.