-
-
Save plainspooky/bbf04e28819c09bac4279f042b01c758 to your computer and use it in GitHub Desktop.
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 | |
email_REGEX="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" | |
email_to_check=${1} | |
if [ -z "${email_to_check}" ]; then | |
echo "É necessário inserir um endereço de e-mail!" | |
exit 2 | |
else | |
if [[ "${email_to_check}" =~ ${email_REGEX} ]]; then | |
echo "O endereço '${email_to_check}' é válido!" | |
else | |
echo "O endereço '${email_to_check}' não é válido!" | |
exit 1 | |
fi | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment