Setting the bash pipefail parameter (via set -o pipefail ) allows the script to crash if a non-zero error is detected, where at any point in the pipe there is a non-zero error.
However, we encounter SIGPIPE errors (error code 141), where data is written to a channel that no longer exists.
Is there a way to set bash to ignore SIGPIPE errors, or is there an approach to writing an error handler that will handle all error status codes, but say 0 and 141?
For example, in Python, we can add:
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
apply default behavior to SIGPIPE errors: ignore them (see http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-06/3823.html ).
Is there a similar option in bash?
source share