I am trying to figure out a best way for running a while loop that read an input and the input can only be Y or N(upper or lower case), if something else has been entered (other than y or n) then run loop again.... also run loop again if its blank....below is what i came up with, but i am not that is not the best solution and does not seem to be working...
read ANS
while [[ $ANS = "" ]]; do
echo "This Cannot be Blank, Please enter answer again"
read ANS
done
while :
do
echo "Enter Y for yes, N for no"
read system
case "${system}" in
[yY]) export ANS=YES ;;
[pP]) export ANS=NO ;;
esac
done