Created
October 6, 2013 06:51
-
-
Save x684867/6850444 to your computer and use it in GitHub Desktop.
Bash Script for getting a quick "yes/no" response from a user.
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
| getYesNo(){ | |
| Y="" | |
| while [ -z "$Y" ]; do | |
| read -n 1 -p $1 Y | |
| Y="$(echo $Y | tr -s A-Z a-z | tr -dc YN)" | |
| done | |
| echo "$Y" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment