I have a function and would like to use the pipefail
option inside. But I don't want to simply set -o pipefail
, because I fear that another part of the script may not expect pipefail
to be set. Of course I could do set +o pipefail
afterwards, but in case pipefail
was set outside of my function, this may introduce unexpected behavior as well.
Of course I could use the exit code of false | true
as a measure, if pipefail
is set, but this seems a little bit dirty.
Is there a more general (and maybe canonical?) way to check the set bash options?