红联Linux门户
Linux帮助

shell脚本出现syntax error near unexpected token `do'错误怎么解决啊

发布时间:2014-03-26 16:08:38来源:红联作者:xiariyingying
#!/bin/bash
if [ $#-eq 0 ]
then
echo"choose the program:"
echo"a:tongji b:exit"
do
read choose
case $choose in
"a")
echo"input the address"
read FILE
WORD='cat $FILE|wc -w'
echo"weenjian:$FILE number:$WORD"
echo"========================"
;;
"b")
exit
;;
*)
echo"you input a error number"
;;
esac
done


else
total=0

while[ $#-ne 0 ]
do
((total+='wc -w $1 |cut -d\ -f1'))

echo $1
shift
done
echo total is $total

fi
这个程序怎么会出现syntax error near unexpected token `do'这个错误呢
文章评论

共有 4 条评论

  1. qd_leo 于 2014-04-04 11:16:14发表:

    1# xiariyingying


    帮顶

  2. qd_leo 于 2014-04-04 11:15:45发表:

    路过

  3. 志在远方 于 2014-03-29 13:29:30发表:

    支持

  4. xkin_z 于 2014-03-26 22:36:52发表:

    第一个do和done用错了,没有循环为何要用do和done