while read inputline; do
if [ "$inputline" != "" ] ; then
if [ ! -z "`(echo $inputline | grep \#END)`" ]; then
break
fi
fi
done
Looks like the script hangs when stdin is empty or contains space. Any ideas on how to circumvent this? is it possible to use getline to process stdin content?
I don't see any reason that should hang unless stdin does. What do you have on stdin?
For that matter -- what's your system? What's your shell? I'm sure you don't need to use grep in backticks to tell whether the string contains #END, using shell builtins will be hundreds of times faster.