Skip to content

Instantly share code, notes, and snippets.

@RustingSword
Created October 23, 2011 02:49
Show Gist options
  • Save RustingSword/1306793 to your computer and use it in GitHub Desktop.
Save RustingSword/1306793 to your computer and use it in GitHub Desktop.
#!/bin/bash
last=0
cur=0
while [ : ]
do
mailcheck | grep new 2>&1 >/dev/null
if [ $? -eq 0 ]
then
cur=$(mailcheck | awk 'BEGIN {sum=0} ; $4~/new/ {sum=sum+1}; END {print sum}')
if [ $cur -ne $last ]
then
notify-send "<span color=\"green\" size=\"16000\">New Mail: $cur</span>" -t 300000
last=$cur
fi
fi
sleep 300
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment