I have a pizza builder code. It gives the user to chose a pizza size and a list of toppings from a side file. I'm trying to validate users input so it can enter a number between 1 and the amount of toppings from the side file.
I'm getting the number of rows from the file and set it to a variable using wc
numtop=$( cat Toppings | wc -l );
After that I read the users input and run a check using if
read topp
if [[ "$topp" < 1 || "$topp" > "$numtop" ]]; then
echo "Enter from 1 to " $numtop
else
echo "Good choice"
fi
But it allows me to enter only 1 or the number from my $numtop variable. I can't understand why this doesn't work.