I'm writing a script and I'd like to use set -o pipefail on shells that support it. Dash does not support that option. Usually, || true lets me swallow errors, but not in case of set:
> podman run python:3.8 sh -c "set -o pipefail && echo OK || echo BAD"
sh: 1: set: Illegal option -o pipefail
The error terminates the script execution immediately without giving me a chance to catch it.
bashwhy bother trying to supportdash? Keep it simple and either makebasha prerequisite or else drop back to writing POSIX shell code and avoid usingbashisms. If you mix you'll either lose the benefit of one or have unexpected effects from code that's unsupporteddashsupportspipefailsince version 0.5.13