I have the following script that continuously accepts input from the user until he/she enters some form of y* or Y*.
while true; do
read -p "Are you ready? " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) ;;
* ) echo "Please answer yes or no.";;
esac
done
However, I would like to break out of the while loop when the user simply presses enter. I tried using \n, \r, and \r\n but these don't seem to be the right patterns.
I am using Cygwin if that makes a difference (though I would also like to know the answer for a Linux distribution like Ubuntu).