by devnonymous · 7y ago · 0 comments
> When the right side of the pipe ends, the shell kills the left side.
That's technically incorrect. The shell sends SIGPIPE to the subshell. SIGPIPE can be trapped/ignored (man trap) and although the default disposition is to kill the process that receives the signal, this might not be always true.
For instance, what do you suppose would happen with this:
(x=42; echo $x 1>&2 ) | echo blue
versus: (trap '' PIPE; x=42; echo $x 1>&2 ) | echo blue
in a loop ?No comments yet.