Created
December 18, 2019 23:13
-
-
Save IkarosKappler/8254f2cc01fe73f975ace8cd99d29ef6 to your computer and use it in GitHub Desktop.
A bash snippet to request a Y/N confirmation from the user.
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 really wish to do this thing? (y/n)? " yn | |
case $yn in | |
[Yy]* ) echo "Doing the thing now."; 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