Created
February 29, 2024 04:14
-
-
Save pablohdzvizcarra/b8746030126733000836d170bad8ebdc to your computer and use it in GitHub Desktop.
Validates if a password was introduce two times equals
This file contains 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
#!/bin/bash | |
# Program to validate a password | |
if read -t 10 -sp "Enter secret phrase > " secret_pass; then | |
echo -e "\nSecret passphrase was configured" | |
if read -t 10 -sp "Enter the secret phrase again > " secret_pass_two; then | |
if [[ "$secret_pass" == "$secret_pass_two" ]]; then | |
echo -e "\nThe password was validated" | |
else | |
echo -e "\nThe passwords are not equals $secret_pass and $secret_pass_two" | |
fi | |
fi | |
else | |
echo -e "\nInput time out" >&2 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment