Morph9@lemmy.zip to linuxmemes@lemmy.worldEnglish · 12 hours agoSudo disbelieflemmy.zipexternal-linkmessage-square73fedilinkarrow-up1245arrow-down110
arrow-up1235arrow-down1external-linkSudo disbelieflemmy.zipMorph9@lemmy.zip to linuxmemes@lemmy.worldEnglish · 12 hours agomessage-square73fedilink
minus-squarePotatoesFall@discuss.tchncs.delinkfedilinkarrow-up8·11 hours agoLet’s say I run something like rm a.txt && rm b.txt, will sudo !! work for both commands or just the first?
minus-squarePoolloverNathan@programming.devlinkfedilinkEnglisharrow-up2·5 hours ago!! is pure textual substitution, so it’d be sudo rm a.txt && rm b.txt. You could do something like sudo sh -c "!!" though.
minus-squareDasFaultier@sh.itjust.workslinkfedilinkEnglisharrow-up4·10 hours agoI wasn’t sure, so I tested this. Turns out, only a.txt would be deleted and removal of b.txt fails due to lack of permissions.
minus-squareSkullgrid@lemmy.worldlinkfedilinkarrow-up6·edit-211 hours ago!! basically pastes the last … action you took as an interaction with the shell. it’s the same as pressing the up arrow, and putting whatever you want in the same position relative to the !! https://youtu.be/PRm6tYo8nGY?t=64
minus-squareDasFaultier@sh.itjust.workslinkfedilinkEnglisharrow-up4·10 hours agoRelevant bash manpage section here.
Let’s say I run something like
rm a.txt && rm b.txt, willsudo !!work for both commands or just the first?!!is pure textual substitution, so it’d besudo rm a.txt && rm b.txt. You could do something likesudo sh -c "!!"though.I wasn’t sure, so I tested this. Turns out, only
a.txtwould be deleted and removal ofb.txtfails due to lack of permissions.!! basically pastes the last … action you took as an interaction with the shell. it’s the same as pressing the up arrow, and putting whatever you want in the same position relative to the !!
https://youtu.be/PRm6tYo8nGY?t=64
Relevant bash manpage section here.
Both