How to write a bash script, if enter empty value "", or other value than 1 and 2 will not end the script, and will let user to renter 1 or 2. Basely if user type wrong, will let user to renter.
echo Press 1 for services and 2 for chkconfig?
echo -n "Please input yes or no: "
read ANS
if [ $ANS != "" ];
if [ $ANS == 1 ];
then
service vsftpd status
elif [ $ANS == 2 ];
then
service vsftpd status
else
echo please input 1 oe 2
fi
~