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.

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 "Bye"}'

...when I then did a:

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

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

--
-Chuck

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to