#ifelse_score 脚本用于对学生成绩进行分类 #!/bin/bash #提示用户输入分数 echo "Please Input a score [0-100]:" read score #判断学生分数 if [ "$score" -lt 0 -o "$score" -gt 100 ] then echo "The score you input is not in [0-100]" exit 1 else if [ "$score" -gt 79 ] then echo "The grade is A" else if [ "$score" -gt 69 -a "$score" -lt 80 ] then echo "The grade is B" else if [ "$score" -lt 70 ] then echo "The grade is C" fi fi fi fi
转载于:https://blog.51cto.com/11468437/1862263