Re: How to get bash to shut up about SIGPIPE?
- From
David A. Wheeler <dwheeler@dwheeler.com>
- Date
- May 1, 2005, 15:51 UTC
- Message-ID
- <4274FB10.6090600@dwheeler.com>
- In-Reply-To
- <E1DSDER-0000kS-00@gondolin.me.apana.org.au>
Herbert Xu wrote:
> This issue has been around for years. The discussion that led to > Debian setting this option may be helpful in understanding it: > > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=10494
Thanks for the pointer. That discussion points to some alternative fixes that may be more useful (instead of installing a repaired shell).
One approach is to install a trap for SIGPIPE in
non-terminating command in a pipeline where the
later items might not process all the data, e.g.:
(trap {} SIGPIPE; find .) | head -1<rant> THIS IS A REALLY, REALLY BAD DECISION BY THE BASH TEAM. Why should the default be "create annoying spurious error report?". This should at least be a run-time settable option, with the OPPOSITE default. </rant>
Which is sad, bash is generally reasonably good. I guess now I have to say "bash, once properly configured using DONT_REPORT_SIGPIPE, is reasonably good."
--- David A. Wheeler