@RedditEnjoyer to [email protected] • 1 year agoA Linux user's nightmare: the machine was wiped clean with one clickwww.mikrobitti.fiexternal-linkmessage-square48arrow-up1119arrow-down113file-textcross-posted to: technology
arrow-up1106arrow-down1external-linkA Linux user's nightmare: the machine was wiped clean with one clickwww.mikrobitti.fi@RedditEnjoyer to [email protected] • 1 year agomessage-square48file-textcross-posted to: technology
minus-squareUnityDevicelinkfedilink26•1 year agoset -euo pipefail at the top of every script makes stuff a lot safer. Explanation here.
minus-square@[email protected]linkfedilink8•1 year agoYep! I always do this too. TL;DR: e aborts the whole script on a non-zero error. u aborts when using an undefined variable. -o pipefail aborts a piped compound command when one of the piped commands fail. Any other way lies madness. Or erasing the whole filesystem apparently!
set -euo pipefail
at the top of every script makes stuff a lot safer. Explanation here.Yep! I always do this too.
TL;DR:
e
aborts the whole script on a non-zero error.u
aborts when using an undefined variable.-o pipefail
aborts a piped compound command when one of the piped commands fail.Any other way lies madness. Or erasing the whole filesystem apparently!