scripts

Various scripts for UNIX-like systems
git clone https://git.tronto.net/scripts
Download | Log | Files | Refs | README

mail-checknow (343B)


      1 #!/bin/sh
      2 
      3 # Check for new email, save result to file.
      4 # Requires: mpop, notify-send or similar
      5 
      6 file="$XDG_DATA_HOME/newmail"
      7 #notify="notify-send"
      8 notify=herbe
      9 
     10 l=$(cat "$file")
     11 n=$(mpop -s | awk '/new*./{print $2}')
     12 
     13 if [ -n "$n" ]; then
     14 	echo "$n" > "$file"
     15 	if [ "$n" != "no" ] && [ "$l" != "$n" ]; then
     16 		$notify "New email ($n)"
     17 	fi
     18 fi