5

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

  • 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
8

Try:

!!:0- new_last_argument

See this article for an overview.

  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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