How to verify an e-mail address in bash script ?
To verify an e-mail address, we take help of regular expressions in bash script.
script is as follows:
#!/bin/bash regex="^(([-a-zA-Z0-9\!#\$%\&\'*+/=?^_\`{\|}~]+|(\"([][,:;<>\&@a-zA-Z0-9\!#\$%\&\'*+/=?^_\`{\|}~-]|(\\\\[\\ \"]))+\"))\.)*([-a-zA-Z0-9\!#\$%\&\'*+/=?^_\`{\|}~]+|(\"([][,:;<>\&@a-zA-Z0-9\!#\$%\&\'*+/=?^_\`{\|}~-]|(\\\\[\\ \"]))+\"))@\w((-|\w)*\w)*\.(\w((-|\w)*\w)*\.)*\w{2,4}$" echo "ENTER THE E-MAIL ADDRESS" read i if [[ $i =~ $regex ]] ; then echo "OK" else echo "not OK" fi
Now run the script and type the e-mail address u want to check.
If result is not found or irrelevant, Please contact us.
Submit your request