11 ms·
I have created a similar library for bash. However, there are more pitfalls related to errexit, see [1] and even shellcheck can not help there. I have tried to
by rustshellscript 6y ago
I have created a similar library for bash. However, there are more pitfalls related to errexit, see [1] and even shellcheck can not help there. I have tried to solve the pitfalls in my library, but it turned out to be ugly and unreliable. That's why I'm trying to use rust [2] for shell scripting like tasks nowadays.
[1] https://github.com/anordal/shellharden/blob/master/how_to_do_things_safely_in_bash.md#gotcha-errexit-is-ignored-in-command-arguments https://github.com/anordal/shellharden/blob/master/how_to_do...
[2] https://github.com/rust-shell-script/rust_cmd_lib https://github.com/rust-shell-script/rust_cmd_lib
- maddyboo 6y agoYour [1] doesn’t mention it, but I find shopt -s inherit_errexit to be indispensable. https://twitter.com/hellsmaddy/status/1273744824835796993?s=21 https://twitter.com/hellsmaddy/status/1273744824835796993?s=...