2 ms·
I've done a bit of porting bash scripts to posix recently and I've found the following boilerplate pretty useful: case "$(readlink /proc/$$/exe)" in */bash
by arglebargle123 7y ago
I've done a bit of porting bash scripts to posix recently and I've found the following boilerplate pretty useful:
case "$(readlink /proc/$$/exe)" in */bash) set -euo pipefail ;; *) set -eu ;; esac
That takes care of setting -eu for shells that don't support -o pipefail and pipefail for bash.