Created
April 20, 2021 18:12
-
-
Save gammazero/410739a23a2666eefc4bc3ef31a7fdb8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function ask_yes_no() { | |
local prompt="$1" | |
while true; do | |
read -p "$prompt [y/n]?" yn | |
case "$yn" in | |
[Yy]* ) return 0;; | |
[Nn]* ) return 1;; | |
* ) echo "Please answer y or n";; | |
esac | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment