I am trying to write a script that will continue to prompt a user to enter a grade, until the user enters 999.
If the user enters 90 or more, echo A. If the user enters 80 or more, echo B. If the user enters 70 or more, echo C. Otherwise echo Failed.
I am thinking this needs a WHILE script. Below is my current code
#!/bin/bash
# Asuume that the first paramter is going to be a grade
if [ $# -lt 1 ];
then
echo -n "Please pass a a grade "
fi
gr=$1
if [ $gr -ge 90 ]
then
echo "A"
elif [ $gr -ge 80 ]
then
echo "B"
elif [ $gr -ge 70 ]
then
echo "C"
else
echo "Failed"
fi
exit 0
The script prompts me, but closes after I enter 1 grade.
Thanks in advance