coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does head util cause SIGPIPE?


From: Pádraig Brady
Subject: Re: Does head util cause SIGPIPE?
Date: Sat, 26 Oct 2019 01:08:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Thunderbird/70.0

On 25/10/2019 08:56, Ray Satiro wrote:
Recently I tracked down a delay in some scripts to this line:

find / -name filename* 2>/dev/null | head -n 1

Some notes:

find(1) will only get the sigpipe if it writes _after_ head(1) exits.

The write pattern is dependent on the buffering in the pipeline. See:
https://www.pixelbeat.org/programming/stdio_buffering/

If you do want to only print a _single_ file, you can do this within find(1) 
like:
  find / -name 'initrd*' -print -quit

cheers,
Pádraig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]