commit 98552f51656821de2f921f6dd0d02a1a057ebb48
parent a7153f697f7e5d4640a7aba6dd33002497deb9f7
Author: Anders Damsgaard <andersd@riseup.net>
Date: Mon, 3 Apr 2017 15:35:47 -0400
end script if maildir doesn't exist
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/bin/mailstatus.sh b/bin/mailstatus.sh
@@ -1,5 +1,9 @@
#!/bin/bash
-newmails=$(find ~/Mail/*/INBOX/new -type f)
+maildir=~/Mail
+if [ ! -d $maildir ]; then
+ exit 0
+fi
+newmails=$(find $maildir/*/INBOX/new -type f)
numbernewmails=$(echo $newmails | wc -w | sed 's/ *//')
mailboxes="$(echo $newmails | tr ' ' '\n' | sed 's/.*Mail\///' | sed 's/\/INBOX.*//')"