Skip to content

Instantly share code, notes, and snippets.

@corbtastik
Last active January 23, 2022 20:55
Show Gist options
  • Save corbtastik/44b5cd348100361db4514d8f340d8d8b to your computer and use it in GitHub Desktop.
Save corbtastik/44b5cd348100361db4514d8f340d8d8b to your computer and use it in GitHub Desktop.
Bash yes no choice snippet
#!/bin/bash
while true; do
read -p "Do you wish to continue (yes or no)? " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment