Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created January 8, 2014 20:39
Show Gist options
  • Save coderofsalvation/8324193 to your computer and use it in GitHub Desktop.
Save coderofsalvation/8324193 to your computer and use it in GitHub Desktop.
checks if string is valid email (bash function)
# checks if string is valid email
function isemail(){
emailTest=$(echo "${1}" | grep '^[a-zA-Z0-9._%+-]*@[a-zA-Z0-9]*[\.[a-zA-Z0-9]*]*[a-zA-Z0-9]$')
if [[ "$emailTest" != "" ] ; then return 0; else return 1; fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment