Bash yes/no prompt Oct 26, 2021 while true; do read -p "Do you wish to do X? " yn case $yn in [Yy]* ) some_function_or_command; break;; [Nn]* ) break;; * ) echo "Please answer yes or no.";; esac done