@veerain your suugestion works good, the only problem is when the user enters an invalid entry it errors out. Also since this you used the
Code:
if [ $ctrl -le 5 ]; then
is accepts the 0 value. I would like more of a graceful exit.
Code:
./test.sh: line 89: [: a: integer expression expected
@chrism01: your solution is working, however when the user selects the correct value. it just says "match" and exits. In my script if the ctrl value is valid I would like it to continue the script.
@pan64 thanks for your suggestion however I tried this in the past but do not know how to set up the regex.
Code:
case expression in $ctrl
*^[1-5]* )
"Continueing with script ;;
*[a-Z,0,6-9]* )
"Please Enter a whole number from 1-5 ONLY" ;;
esac
Basically ctrl is a varible I set-up on a more elobrate script.