Re:How to write to stderr so people will like you
by sorbits on Friday April 16, 2010 @03:44PM
(#1271690)
I am not sure what you are referring to, but the case where EPIPE is useful is incase you do something like:
grep foo *.txt|head -n10
Here head will close its stdin after having read 10 lines. If grep writes more it will get the EPIPE error on write (which may indirectly be called by fflush).
This will also send the SIGPIPE signal which by default will kill the process, so grep is automatically terminated when no more output will be read from it.
This will also send the SIGPIPE signal which by default will kill the process, so grep is automatically terminated when no more output will be read from it.