Better, but still better is to use a while loop for the outer part.
The problem with "while read foo" in shell is that it will do a system
call per byte. If you can move all the other processing inside awk,
that is preferable. The test builtin is less expensive than the reading
though, so
awk ... | while read prog alternative; do
if [ -x "$prog" ]; then
echo $alternative
break
fi
done
or so is most readable and involves the smallest number of forks.
Joerg