▲ 470 ▼ rm -rf /usr due to typo (sh.itjust.works) submitted 4 days ago by testaccount789@sh.itjust.works to c/programmer_humor@programming.dev 49 comments fedilink hide all child comments https://github.com/MrMEEE/bumblebee-Old-and-abbandoned/issues/123
[–] OwOarchist@pawb.social 140 points 3 days ago (3 children) rm -rf "$STEAMROOT/"* could be evaluated as rm -rf "/"* if $STEAMROOT is empty Ah, good times. permalink fedilink source parent hideshow 6 child comments replies: [–] Fmstrat@lemmy.world 19 points 3 days ago I love how someone committed # scary! above it rather than fixing it. permalink fedilink source parent [–] victorz@lemmy.world 30 points 3 days ago (2 children) Probably a good idea to enable the nounset shell option when shipping commercial-grade install scripts. 😅 permalink fedilink source parent hideshow 4 child comments replies: [–] fruitcantfly@programming.dev 7 points 3 days ago* (last edited 3 days ago) That really ought to have been the default behavior. Opting out only takes one or two extra characters. Well, three or four if you don't habitually bracket your variable names, which you should probably be doing anyways permalink fedilink source parent [–] OwOarchist@pawb.social 4 points 3 days ago (1 child) Or just include the trailing slash in $STEAMROOT, so that if the variable is empty, it will evaluate to rm -rf "" and do nothing. permalink fedilink source parent hideshow 2 child comments replies: [–] victorz@lemmy.world 7 points 3 days ago That seems like a more error-prone solution than the shell option. That would make it evaluate to rm -rf * which would probably delete your home directory, I'm guessing. And also put the burden of knowing the slash needs to be included on something completely disconnected from the expression. Nah, don't do it like that. permalink fedilink source parent [–] sp3ctr4l@lemmy.dbzer0.com 20 points 3 days ago Wow. That's a nuclear grade 'oopsie' right there hahaha! permalink fedilink source parent
[–] Fmstrat@lemmy.world 19 points 3 days ago I love how someone committed # scary! above it rather than fixing it. permalink fedilink source parent
[–] victorz@lemmy.world 30 points 3 days ago (2 children) Probably a good idea to enable the nounset shell option when shipping commercial-grade install scripts. 😅 permalink fedilink source parent hideshow 4 child comments replies: [–] fruitcantfly@programming.dev 7 points 3 days ago* (last edited 3 days ago) That really ought to have been the default behavior. Opting out only takes one or two extra characters. Well, three or four if you don't habitually bracket your variable names, which you should probably be doing anyways permalink fedilink source parent [–] OwOarchist@pawb.social 4 points 3 days ago (1 child) Or just include the trailing slash in $STEAMROOT, so that if the variable is empty, it will evaluate to rm -rf "" and do nothing. permalink fedilink source parent hideshow 2 child comments replies: [–] victorz@lemmy.world 7 points 3 days ago That seems like a more error-prone solution than the shell option. That would make it evaluate to rm -rf * which would probably delete your home directory, I'm guessing. And also put the burden of knowing the slash needs to be included on something completely disconnected from the expression. Nah, don't do it like that. permalink fedilink source parent
[–] fruitcantfly@programming.dev 7 points 3 days ago* (last edited 3 days ago) That really ought to have been the default behavior. Opting out only takes one or two extra characters. Well, three or four if you don't habitually bracket your variable names, which you should probably be doing anyways permalink fedilink source parent
[–] OwOarchist@pawb.social 4 points 3 days ago (1 child) Or just include the trailing slash in $STEAMROOT, so that if the variable is empty, it will evaluate to rm -rf "" and do nothing. permalink fedilink source parent hideshow 2 child comments replies: [–] victorz@lemmy.world 7 points 3 days ago That seems like a more error-prone solution than the shell option. That would make it evaluate to rm -rf * which would probably delete your home directory, I'm guessing. And also put the burden of knowing the slash needs to be included on something completely disconnected from the expression. Nah, don't do it like that. permalink fedilink source parent
[–] victorz@lemmy.world 7 points 3 days ago That seems like a more error-prone solution than the shell option. That would make it evaluate to rm -rf * which would probably delete your home directory, I'm guessing. And also put the burden of knowing the slash needs to be included on something completely disconnected from the expression. Nah, don't do it like that. permalink fedilink source parent
[–] sp3ctr4l@lemmy.dbzer0.com 20 points 3 days ago Wow. That's a nuclear grade 'oopsie' right there hahaha! permalink fedilink source parent