Skip to content

Instantly share code, notes, and snippets.

@deckerego
Created December 6, 2013 16:53
Show Gist options
  • Save deckerego/7828185 to your computer and use it in GitHub Desktop.
Save deckerego/7828185 to your computer and use it in GitHub Desktop.
Prompt and confirm a password in a bash/sh shell
read -s -p "Password: " PASSWORD; echo
read -s -p "Confirm Password: " PASSCONFIRM; echo
if [[ "$PASSWORD" != "$PASSCONFIRM" ]]; then
echo "Passwords do not match, exiting"
exit -1
fi
echo "Passwords match!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment