发新话题
打印

保证if-elif至少执行一组指令,是这样吗?

保证if-elif至少执行一组指令,是这样吗?

哦,超郁闷的......其他的都好理解和编写,就是这个if-elif有点烦的,我写了一个这样的代码:
clear
echo "Enter Bing Number:"
read Bing
if [ $Bing -eq 100 ]
   then
      echo "The box is full."
   elif [ $Bing -eq 95 ]
   then
      echo "You can add 5 cookies to the box."
   elif [ $Bing -eq 85 ]
   then
      echo "You can add 15 cookies to the box."
   elif
      echo "You can many cookies to the box."
fi

还是有点问题,说什么syntax error near unexpected token 'fi',这是什么原因啊?哎......
最后一个elif改成else。
谢谢,
发新话题