考试成绩 + centos 7.3

Bash分数评价脚本
本文介绍了一个使用Bash编写的简单脚本,该脚本根据用户输入的成绩进行不同的反馈。当成绩达到特定阈值时,脚本会输出相应的评价信息。

root@node1 shell]# cat scores.sh
#!/bin/bash
#By author lansefenghuo
read -p "Please input the scores:" scores
if [ $scores -eq 100 ]
then
echo "very good!";
elif [ $scores -gt 85 ]
then
echo "good!";
elif [ $scores -gt 60 ]
then
echo "pass!";
elif [ $scores -lt 60 ]
then
echo "no pass!"
elif [ $scores = 0 ]
then
echo "Oh, My God!"
fi

[root@node1 shell]# sh scores.sh
Please input the scores:85
pass!
[root@node1 shell]# sh scores.sh
Please input the scores:86
good!
[root@node1 shell]# sh scores.sh
Please input the scores:85
pass!
[root@node1 shell]# sh scores.sh
Please input the scores:59
no pass!
[root@node1 shell]#

转载于:https://blog.51cto.com/13497623/2045399

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值