- 论坛徽章:
- 0
|
有哪个好心点的牛。。路过看看
#!/bin/bash
echo "*************************************************"
echo "** This is shell scripts count english word **"
echo "*************************************************"
echo "***************useage****************************"
echo " "
echo " 1.display all 2. words total "
echo " 3.repeat words 4. exit "
echo "*************************************************"
echo "*************************************************"
sb=word.txt
read -p "Please type the fun:" a
if [ $a = "1" ]
then
while read -r line
do
echo $line
done <$sb
exit 0
fi
if [ $a = "2" ]
then
cat $sb|wc -w
exit 0
fi
if [ $a = "3" ]
then
exit 0
fi
if [ $a = "4" ]
then
exit 0
fi
# when run here ,Error! why?
echo "your input is wrong!"
exit 1 |
|