Skip to content

Instantly share code, notes, and snippets.

@granolocks
Last active January 3, 2016 12:49
Show Gist options
  • Select an option

  • Save granolocks/8465004 to your computer and use it in GitHub Desktop.

Select an option

Save granolocks/8465004 to your computer and use it in GitHub Desktop.
Verify Y / N
f_verify(){
echo "1. Yes"
echo "2. No"
read -p "Are you sure?: " input
matches=$(echo $input | grep -ie "^[Y|1]")
if [ $? -ne 0 -a -n $matches ]; then
echo "You must enter 'yes' to continue."
exit
fi
}
f_verify
echo "yes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment