Add snippet 'is_valid_email_address.sh'.

This commit is contained in:
Christoph 2018-05-12 04:25:28 +02:00
parent b711467694
commit 11ad9d07c6

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
email=$1
regex_email="^[A-Za-z0-9._+-]+@([A-Za-z0-9-]+\.)+[A-Za-z]{2,}$"
if [[ "$email" =~ $regex_email ]]; then
echo "Email address $email is valid."
else
echo "Email address $email is invalid."
fi
exit 0