成绩等级统计

写一段bash shell,从键盘输入学生成绩,显示相应的等级。。。

可以输入多个,用空格隔开即可


#!/bin/bash
#by zy
function iscontinue()
{
while true
do
echo -n "continue?(Y/N)"
read op
case $op in
[Yy]) return 0;;
[Nn]) return 1;;
*)echo "enter y or n"
esac
done
}
echo "This is a score judgement bash!"
while true
do
echo -n "Please enter the guys' score: "
read score
a=($score)
len=${#a[@]}
for((j=0;j<"$len";j=j+1))
do
if [ "${a[$j]}" -gt 100 ];
then
echo -n "the score is"
echo " is grater than 100!Error!"
else
case ${a[$j]} in
100|9[0-9]) echo "excellent!";;
8[0-9]) echo "Good!";;
7[0-9]) echo "Medium!";;
6[0-9]) echo "Passed!";;
[0-9]|[0-5][0-9]) echo "Fuck!u r failed";;
*) 
echo "error!"
;;
esac
fi
done
if iscontinue
then
continue
else
break
fi
done
exit 


转载于:https://www.cnblogs.com/m1s4nthr0pezy/p/3787638.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值