grep -q causes sigpipe
maxice8 opened this issue · 2 comments
maxice8 commented
trying
if(strings $binary | grep -q -x archive/zip) echo $binary
always fail since the resulting status is sigpipe 0
, the same does not happen if one uses grep -x archive/zip >/dev/null
rakitzis commented
This is the documented behavior of pipeline statuses.
The exit status of a pipeline is considered true if and only if every
command in the pipeline exits true.
The sigpipe
occurs because grep is exiting early, so strings
writes to a broken pipe.
maxice8 commented
Thanks for the quick explanation