tail does not exit

Chuck Swiger cswiger at mac.com
Thu Dec 20 10:48:42 PST 2007

On Dec 20, 2007, at 1:58 AM, Mikhail Teterin wrote:
> On середа 19 грудень 2007, Chuck Swiger wrote:
> = A quick test suggests that "tail -f" will close when it gets a  
> SIGPIPE? How is that relevant? Does tail get a SIGPIPE, when awk  
> disappears
> in my example? If it does not, why do you bring it up?

tail should get a SIGPIPE when it tries to write to a pipeline where  
the other end has closed.

> And if it does get SIGPIPE, then you are wrong, because the posted
> "quick test" shows the exact opposite behavior -- tail does NOT go
> away.
> Please, clarify... Thanks.

Worked for me.  I opened two SSH sessions to a FreeBSD 5.5 system, and  
did this in one:

% touch /tmp/logfile
% echo "line 1" >> /tmp/logfile

...and this in the other:

% tail -f /tmp/logfile | awk '{print "Line: " $1 ;  exit(0)}END{print  

...when I then did a:

% echo "line 2" >> /tmp/logfile

...in the first, the tail -f process terminated in the second.


More information about the freebsd-questions mailing list