Thread (22 messages) flat view 22 messages, 9 authors, 2016-06-15

Re: How to get bash to shut up about SIGPIPE?

From: David A. Wheeler <hidden>
Date: 2016-06-15 22:41:56

I reported:
quoted
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
Paul Jackson wrote:
Both the versions of bash that I looked at (2.05 and 3.0) _still_
complain even if SIGPIPE is trapped - they just complain with
a more terse message, unless DONT_REPORT_SIGPIPE is not defined.
...
What bash do you have that this trap silences?
Actually, I have a working bash, so I can't test any of
these work-arounds.  I was merely foolish enough to quote
the Debian discussion, where someone reported that as a
work-around. I had hopes that it would help.
That'll teach me to pay attention to documentation :-).

I wonder, does a top-level trap work? E.g.:
  trap "" SIGPIPE
  ...

Anyone, good luck to those with broken bashes...
--- David A. Wheeler
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help