Waffelson@lemmy.world to linuxmemes@lemmy.world · 6 months agoWhen you realized you forgot sudolemmy.worldimagemessage-square11fedilinkarrow-up1297arrow-down116
arrow-up1281arrow-down1imageWhen you realized you forgot sudolemmy.worldWaffelson@lemmy.world to linuxmemes@lemmy.world · 6 months agomessage-square11fedilink
minus-squareEsca@lemmy.onelinkfedilinkarrow-up13·6 months agoIsn’t this the same effect as just running ‘sudo !!’ ?
minus-squaresubtext@lemmy.worldlinkfedilinkarrow-up10·6 months agoAccording to this super user question, someone said that !! won’t work in a function, so you must use the fc -ln -1 command in a subshell instead. Note the response that says eval shouldn’t be used (not sure why)
minus-squareEsca@lemmy.onelinkfedilinkarrow-up6arrow-down1·6 months agoYeah but instead of a function you just make it an alias.
minus-squaresubtext@lemmy.worldlinkfedilinkarrow-up1arrow-down1·6 months agoOh good point, I didn’t think about that
minus-squareCinnamon3431@lemmy.worldlinkfedilinkarrow-up1·6 months agono because it takes the previous command and adds sudo to it right?
minus-squaresubtext@lemmy.worldlinkfedilinkarrow-up4·edit-26 months ago!! is a shortcut for whatever the last command was is it not? E: https://devhints.io/bash#history
Isn’t this the same effect as just running ‘sudo !!’ ?
According to this super user question, someone said that
!!
won’t work in a function, so you must use thefc -ln -1
command in a subshell instead. Note the response that sayseval
shouldn’t be used (not sure why)Yeah but instead of a function you just make it an alias.
Oh good point, I didn’t think about that
no because it takes the previous command and adds sudo to it right?
!!
is a shortcut for whatever the last command wasis it not?E: https://devhints.io/bash#history