I actually really like the idea of sticking the awk script in its own file. That worked well. Now my code appears as...
<clip> if [ "$2" ]
echo "Watching for '$2' in log";
echo "tail -f /var/log/foobar.log | grep '$2' | awk -f /root/foolog.awk";
echo "Watching log";
tail -f /var/log/foobar.log | awk -f /root/foolog.awk;
Now the script executes properly, but the grep seems to eliminate every line. When I run the commands manually ("tail -f /var/log/foobar.log | grep 'test' | awk -f /root/foolog.awk"), I get the same result (even if I grep for "" [nothing]).
It should be possible for me to work the search into the awk script by making it 'next' if it doesn't see the search string in each iteration, but I'm not sure how to do that. I know you can use something like "/[^a-zA-Z]/" to exclude anything that has letters, but I'm not sure how to go about doing the same thing with a string.