Last active
August 29, 2015 14:05
-
-
Save likejazz/a64356132f53b05213ca to your computer and use it in GitHub Desktop.
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 | |
DAUMID=***** | |
DAUMPW=***** | |
# IMAP SSL/TLS | |
response=`{ echo "a001 login $DAUMID $DAUMPW"; sleep 1; echo "a002 select inbox"; sleep 1; echo "a003 logout"; } | /usr/local/bin/gnutls-cli imap.daum.net --port=993` | |
# fetch `UNSEEN` mail count | |
unseen=$(echo $response | grep -oEi 'OK\ \[UNSEEN\ (\d+)' | awk '{print $3}') | |
# if `$UNSEEN` is number, notify to me. | |
if [[ $unseen =~ ^[0-9]+$ ]] ; then | |
terminal-notifier -message "You've got ${unseen} mails." -title "한메일" -open http://hmstage.daum.net/hanmailex/Top.daum | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment