tail does not exit

Mikhail T. mi at aldan.algebra.com
Wed Dec 19 15:41:33 PST 2007


Why does not the script below actually ever exit?

	#!/bin/sh

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

	exit 0

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

Thanks!

	-mi


More information about the freebsd-questions mailing list