commit cdc1c9d66c6bb500c3bf731d7c5de7b26c302fcb
parent 8acc15d7a0bb1154f1e3de1e50a7f25555b9d285
Author: Luke Smith <luke@lukesmith.xyz>
Date: Sun, 7 Oct 2018 15:45:44 -0400
mailsync.sh for posix sh
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/etc/mailsync.sh b/etc/mailsync.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
# This script will run offlineimap and check
# for new email if there is an internet connection.
#
@@ -11,7 +11,7 @@ export DISPLAY=:0.0
# Checks for internet connection and set notification script.
# Settings are different for MacOS (Darwin) systems.
-if [ "$(uname)" == "Darwin" ]
+if [ "$(uname)" = "Darwin" ]
then
ping -q -t 1 -c 1 `ip r | grep -m 1 default | cut -d ' ' -f 3` >/dev/null || exit
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
@@ -32,10 +32,10 @@ pkill -RTMIN+12 i3blocks
for account in $(ls ~/.mail)
do
#List unread messages newer than last mailsync and count them
- newcount=$(find ~/.mail/$account/INBOX/new/ -type f -newer ~/.config/mutt/etc/mailsynclastrun 2> /dev/null | wc -l)
+ newcount=$(find ~/.mail/"$account"/INBOX/new/ -type f -newer ~/.config/mutt/etc/mailsynclastrun 2> /dev/null | wc -l)
if [ "$newcount" -gt "0" ]
then
- notify "$account" "$newcount" & disown
+ setsid notify "$account" "$newcount" &
fi
done
notmuch new