Is it recommended to trap SIGPIPE in bash script? Is it recommended to trap SIGPIPE in bash script? bash bash

Is it recommended to trap SIGPIPE in bash script?


1) That's very hard to answer without knowing exactly what you changed.
2) If a sequence of commands appears in a pipeline, and one of the reading commands finishes before the writer has finished, the writer receives a SIGPIPE signal. So whether you can ignore it depends on whether that is acceptable behavior for your script. More info here


A current version of the FAQ that PiedPiper linked to states:

As of bash-3.1, bash does not report SIGPIPE errors by default. You can build a version of bash that will report such errors.

Is it possible that you changed Bash versions or the way it's built and that caused the change in behavior in your code?