2 ms·
I see you've now updated the post and got the idea. Small nitpick tho'. > When the right side of the pipe ends, the shell kills the left side. That's technica
by devnonymous 8y ago
I see you've now updated the post and got the idea. Small nitpick tho'.
> 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 ?