Bruno Haible wrote: >> That is because something[*] in your environment has arranged to ignore >> SIGPIPE. > > The "ps s" output that I provided shows that SIGPIPE is being caught, not > ignored, by the bash process. But I have no clue why I saw this error > message only in an interactive bash and not while running it as a script. > In the interactive bash these signal masks are active: > UID PID PENDING BLOCKED IGNORED > CAUGHT STAT TTY TIME COMMAND > 1000 28552 0000000000000000 0000000000000000 0000000000380004 > 000000004b817efb S+ pts/11 0:00 /bin/bash > In the batch script bash these are active: > UID PID PENDING BLOCKED IGNORED > CAUGHT STAT TTY TIME COMMAND > 1000 28517 0000000000000000 0000000000010000 0000000000000004 > 0000000043817efb S+ pts/11 0:00 /bin/bash ./test-pread.sh > There is no difference regarding SIGPIPE (= 13, bit 12).
Catching and ignoring SIGPIPE appear to have the same net effect in this case. Bash shouldn't do that. Though note that bash may have inherited that setting from the process that invoked it. Can't you just use a newer version than 3.x? bash-4.0.33 is installed on most systems I use.