4 ms·
Its implied on the list but not mentioned specifically. !! will be substituted with the last command you typed. So if your somebody like me who frequent
by valarauca1 12y ago
Its implied on the list but not mentioned specifically.
!!
will be substituted with the last command you typed. So if your somebody like me who frequently types
$ apt-get update
Could not lock yada yada are you root?
$ sudo apt-get update
instead you can type
$ apt-get update
$ sudo !!
- cheepin 12y agoWhat I love about this is that if you up-arrow through your past commands, the "sudo !!" shows up as "sudo apt-get update"
- valarauca1 12y agoBash substitutions are done prior to execution so your history stays intact. Older open source projects are just amazing for how complete their feature set is.
- pokpokpok 12y agois this how people feel about religious texts?
- valarauca1 12y agoOriginally I was gonna write: >Religious texts don't change over time due to community suggested changes. Then I caught myself.
- carlisle_ 12y agoYou mean my bash fanaticism isn't religious?
- vehementi 12y agoI named my cat sudo bangbang
- a3_nm 12y agoIt always feels more logical to me to just type "Ctrl-P Ctrl-A sudo" (previous history line, beginning of line, add missing sudo) than typing "sudo !!" or "sudo !!<tab>" if you need to edit the substitution. Same thing for the last argument, it's easily edited if you know the right shortcuts: Ctrl-P Alt-B Ctrl-U. (Works for bash, for zsh you need http://stackoverflow.com/q/3483604/414272 http://stackoverflow.com/q/3483604/414272). That said, I didn't know about Alt-.