hi all. i just have a very small problem. i have a menu of 7 choices. i want an if statement so that if the user chooses anything except inside the 1 to 7 range, i can handle the error for it.
Try this one, this idea addresses the RH-side of the equation, namely: ranges of values:
read character
case $character in
# Check for letters
[a-z] | [A-Z] ) echo "Alpha range i[a-z]: You typed the letter $character"
;;
# Check for digits
[0-9] ) echo "Numeric range: 0-9: You typed the digit $character"
;;
# Check for anything else
* ) echo "You did not type a letter or a digit"
esac