Skip to content

Instantly share code, notes, and snippets.

@joshtronic
Last active January 4, 2016 15:19
Show Gist options
  • Save joshtronic/8640234 to your computer and use it in GitHub Desktop.
Save joshtronic/8640234 to your computer and use it in GitHub Desktop.
Checks your unread message count on your Gmail account from the command line using OSX Keychain Access to store the credentials securely.
export KEYCHAIN_ITEM='email' && curl -u `security find-generic-password -s ${KEYCHAIN_ITEM} | grep 'acct' | cut -c 19- | tr -d '"' | tr -d '\n'`:`security find-generic-password -w -s ${KEYCHAIN_ITEM}` --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "$2\n" if /<(email)>(.*)<\/\1>/;' | wc -l | tr -d ' '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment