tail -f hangs script

January 26, 2011 at 07:26:16
Specs: aix
I have a unix korn shell script where I am trying to monitor a file for certain text when it appears. I am using the following two lines in my script.

tail -f testFile.txt | awk -F, '/Looping detected/ { lines[last] = $0 } END { print lines[last]
}' | read founddate1

echo $founddate1

but the program never gets to the echo line.

How do I make this work?

See More: tail -f hangs script

Report •

January 26, 2011 at 10:17:10
I doubt that you can make it work. It's my understanding that tail's -f option puts tail into an endless loop so the user can view the file as it grows.

Also, I don't think you can use a pipe with the read command and expect variable founddate1 to be set.

Report •
Related Solutions

Ask Question