Created
July 4, 2017 14:17
-
-
Save jfcarr/c68e3b2677cdcd74b484f2524f7a3bdb to your computer and use it in GitHub Desktop.
Show unread Gmail message count.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LASTGMAIL="$(curl -u johndoe:mypassword --silent 'https://mail.google.com/mail/feed/atom' | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | sed -n 's/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p' | wc -l)" | |
if [ $LASTGMAIL -ne 0 ] | |
then | |
echo "$LASTGMAIL : [email protected]" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment