I am learning Shell scripting on own. I am trying to do an assignment to get details from the user like username their individual marks ,DOB and send a report in mail with the Details calculated like total and average.
validate_marks() {
local Value=$1
if [ "${Value}" -ge "0" ] && [ "${Value}" -le "100" ]
then
return 0
else
echo "Enter numbers between 0-100"
exit 1.
fi
}
echo "Enter Marks for each subject:"
read -p "Enter English Marks:" ENG
validate_marks $ENG
read -p "Enter Maths Marks:" MATHS
validate_marks $MATHS
read -p "Enter Science Marks:" SCI
validate_marks $SCI
read -p "Enter History Marks:" HIST
validate_marks $HIST
read -p "Enter your Email id:" EMAIL
validate_email $EMAIL
In the validate marks function I am checking if the value entered is between 0 -100 if it is more return error and go back to prompt until it is correct. How do I achieve this