Created
January 15, 2016 14:27
-
-
Save gburd/3531ba08647b218b29da to your computer and use it in GitHub Desktop.
"Would you like to continue?" sh function
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
| confirm () { | |
| # call with a prompt string or use a default | |
| read -r -p "${1:-Would you like to continue? [y/N]} " response | |
| case $response in | |
| [yY][eE][sS]|[yY]) | |
| true | |
| ;; | |
| *) | |
| false | |
| ;; | |
| esac | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment