Morph9@lemmy.zip to linuxmemes@lemmy.worldEnglish · 9 days agoSudo disbelieflemmy.zipexternal-linkmessage-square101fedilinkarrow-up1375arrow-down111
arrow-up1364arrow-down1external-linkSudo disbelieflemmy.zipMorph9@lemmy.zip to linuxmemes@lemmy.worldEnglish · 9 days agomessage-square101fedilink
minus-squarePotatoesFall@discuss.tchncs.delinkfedilinkarrow-up8·9 days agoLet’s say I run something like rm a.txt && rm b.txt, will sudo !! work for both commands or just the first?
minus-squareSkullgrid@lemmy.worldlinkfedilinkarrow-up7·edit-29 days 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·9 days agoRelevant bash manpage section here.
minus-squareDasFaultier@sh.itjust.workslinkfedilinkEnglisharrow-up4·9 days 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-squarePoolloverNathan@programming.devlinkfedilinkEnglisharrow-up3·9 days 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.
Let’s say I run something like
rm a.txt && rm b.txt, willsudo !!work for both commands or just the first?!! 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.
I wasn’t sure, so I tested this. Turns out, only
a.txtwould be deleted and removal ofb.txtfails due to lack of permissions.!!is pure textual substitution, so it’d besudo rm a.txt && rm b.txt. You could do something likesudo sh -c "!!"though.Both