Shell程序设计(一)续

来源:互联网 发布:哪些明星开了淘宝店铺 编辑:程序博客网 时间:2024/06/05 07:08

同上
输入成绩,显示成绩等级,成绩输错处理上没有处理字符串的输入

#!/bin/bash#show the level of your scarewhile(true)doecho "please enter score:"read scoreif [ $score -lt 0 ]then    echo "wrong number  enter!"elif [ "$score" -lt 60 ];then    echo "Failed"elif [ "$score" -lt 70 ];then    echo "Passed!"elif [ "$score" -lt 80 ];then    echo "Medium!"elif [ "$score" -lt 90 ];then    echo "Good!"elif [ $score -le 100 ];then    echo "Excellent!"else    echo "wrong number enter"fiecho "Do you want to continue? Answer yes or no."read answerif [ $answer = no ]then    exit 0fidoneexit 0
0 0
原创粉丝点击