Last active
January 23, 2022 20:55
-
-
Save corbtastik/44b5cd348100361db4514d8f340d8d8b to your computer and use it in GitHub Desktop.
Bash yes no choice snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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