4 ms·
In Bash 4.4+ you can use: shopt -s inherit_errexit 2>/dev/null || true To make subprocesses inherit the errexit flag.
by polyrand 6y ago
In Bash 4.4+ you can use:
shopt -s inherit_errexit 2>/dev/null || true
To make subprocesses inherit the errexit flag.
- chinigo 6y agoLifesaver! Without this, error handling in bash functions is a gigantic, unintuitive pain. Thank you for bringing this to my attention.
- amelius 6y agoAnd this boilerplate isn't going to be a pain?
- kasabali 6y agoinherit_errexit If set, command substitution inherits the value of the errexit option, instead of unsetting it in the subshell environment. This option is enabled when posix mode is enabled. So must I presume older versions were already doing that without needing an option set?