Skip to content

Instantly share code, notes, and snippets.

@x684867
Created October 6, 2013 06:51
Show Gist options
  • Select an option

  • Save x684867/6850444 to your computer and use it in GitHub Desktop.

Select an option

Save x684867/6850444 to your computer and use it in GitHub Desktop.
Bash Script for getting a quick "yes/no" response from a user.
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