[work@www sh]$ sh -n for.sh for.sh: line 7: syntax error near unexpected token `o' for.sh: line 7: `o' [work@www sh]$
[work@www sh]$ sh -v for.sh
#!/bin/bash
# desc : for loop
for animal in dog cat pig
do
echo "HI, ${animal}"
done
HI, dog
HI, cat
HI, pig
exit;
[work@www sh]$[work@www sh]$ sh -x for.sh + for animal in dog cat pig + echo 'HI, dog' HI, dog + for animal in dog cat pig + echo 'HI, cat' HI, cat + for animal in dog cat pig + echo 'HI, pig' HI, pig + exit [work@www sh]$
原文地址:http://blog.csdn.net/yonggang7/article/details/40680369