Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
check all gmail accounts
#!/bin/bash
gmail_accounts=( 'email1@gmail.com' 'email2@gmail.com' 'email3@gmail.com' )
function check_mail {
curl -u $1 --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "\t" if /<name>/; print "$2\n" if /<(title|name)>(.*)<\/\1>/;'
}
if [ $1 = "all" ]; then
for (( i=0;i<${#gmail_accounts[@]};i++)); do
check_mail ${gmail_accounts[${i}]}
done
else
check_mail $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment