>>>>> "MT" == Mikhail T. writes:

 MT>  Why does not the script below actually ever exit?

 MT>         #!/bin/sh

 MT>         if tail -f /var/log/messages | awk '{print "Exiting"; exit 0}'
 MT>         then
 MT>                 echo Exited
 MT>         else
 MT>                 echo Failed
 MT>         fi

 MT>         exit 0


 MT> Awk exits as advertised, but tail stays around -- even though its
 MT> stdout is closed... Why?

 ---start quote from man 1 tail---

      -f      The -f option causes tail to not stop when end of file is
             reached, but rather to wait for additional data to be appended to
             the input.  The -f option is ignored if the standard input is a
             pipe, but not if it is a FIFO.
 ---end quote---

 try without "-f" option

-- 
Max N. Boyarov

Attachment: pgp85bt53VpkK.pgp
Description: PGP signature

Reply via email to