Hello,
im trying to make a bash script to check if a email address is correct.
I have this regular expression:
[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
Source: http://www.regular-expressions.info/email.html
And this is my bash script:
regex=[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
i="[email protected]"
if [[ $i=~$regex ]] ; then
echo "OK"
else
echo "not OK"
fi
The script fails and give me this output: 10: Syntax error: EOF in backquote substitution
any clue??