華農linux實驗6第2題
#! /bin/bash
function help()
{
echo "Enter score:\n"
}
function menu()
{
while true
do
help
read score
if [ -z "$(echo $score | sed 's#[0-9]##g')" ]
then
if [ $score -ge 0 -a $score -lt 60 ]
then
echo "Failed"
elif [ $score -ge 60 -a $score -lt 70 ]
then
echo "Passed"
elif [ $score -ge 70 -a $score -lt 80 ]
then
echo "Medium"
elif [ $score -ge 80 -a $score -lt 90 ]
then
echo "Good"
elif [ $score -ge 90 -a $score -le 100 ]
then
echo "Excellent"
else
echo "error,please entry the score betwent 0 and 100"
fi
else
echo "Please entry a number"
fi
done
}
echo "Welcome!"
menu
function help()
{
echo "Enter score:\n"
}
function menu()
{
while true
do
help
read score
if [ -z "$(echo $score | sed 's#[0-9]##g')" ]
then
if [ $score -ge 0 -a $score -lt 60 ]
then
echo "Failed"
elif [ $score -ge 60 -a $score -lt 70 ]
then
echo "Passed"
elif [ $score -ge 70 -a $score -lt 80 ]
then
echo "Medium"
elif [ $score -ge 80 -a $score -lt 90 ]
then
echo "Good"
elif [ $score -ge 90 -a $score -le 100 ]
then
echo "Excellent"
else
echo "error,please entry the score betwent 0 and 100"
fi
else
echo "Please entry a number"
fi
done
}
echo "Welcome!"
menu
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.