I have the following script code:
test.sh
echo "BEGIN"
while read CMD <&1; do
[ -z "$CMD" ] && continue
case "$CMD" in
start)
echo "get_start"
;;
stop)
echo "get_stop"
;;
*)
echo "get_uknown_command"
;;
esac
echo "END";
done
When I run it with:
$./test.sh <input.txt
I get my script locked
input.txt
start
stop
sthh
Why my script is locked? How I can fix that?
BTW: If I enter the data manually then the script will not lock.
&0
. – ott-- Jul 12 '13 at 11:01&0
means stdin and&1
means stdout. thnak you for the comment. make it an answer and I will accept it – MOHAMED Jul 12 '13 at 11:03while read CMD; do
should work. – manatwork Jul 12 '13 at 11:12