#!/bin/bash select item in one two three four five do if [ ! -z "$item" ];then echo "Your chose option number $REPLY while is \"$item\"" else echo "$REPLY is not valid." fi done
[root@bogon script]# ./select1.sh 1) one 2) two 3) three 4) four 5) five #? 1 Your chose option number 1 while is "one" #? 3 Your chose option number 3 while is "three" #? 4 Your chose option number 4 while is "four" #? 7 7 is not valid. #? [root@bogon script]#