#!/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'这个错误呢


qd_leo 于 2014-04-04 11:16:14发表:
1# xiariyingying
帮顶
qd_leo 于 2014-04-04 11:15:45发表:
路过
志在远方 于 2014-03-29 13:29:30发表:
支持
xkin_z 于 2014-03-26 22:36:52发表:
第一个do和done用错了,没有循环为何要用do和done