aboutsummaryrefslogtreecommitdiff
path: root/local
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2016-08-18 23:23:15 +0200
committerKarel Kočí <cynerd@email.cz>2016-08-18 23:23:15 +0200
commit1d379fa7826e21be8005282b275048176d809d7d (patch)
tree57884b6f0f370311a20064638bbd3a9ead2e02e4 /local
parentfed33f9b8fd4eedc93df8a0446d51fbd30f6c31f (diff)
downloadmyconfigs-1d379fa7826e21be8005282b275048176d809d7d.tar.gz
myconfigs-1d379fa7826e21be8005282b275048176d809d7d.tar.bz2
myconfigs-1d379fa7826e21be8005282b275048176d809d7d.zip
Add email-unread script
Diffstat (limited to 'local')
-rwxr-xr-xlocal/bin/email-unread37
1 files changed, 37 insertions, 0 deletions
diff --git a/local/bin/email-unread b/local/bin/email-unread
new file mode 100755
index 0000000..0073112
--- /dev/null
+++ b/local/bin/email-unread
@@ -0,0 +1,37 @@
+#!/bin/bash
+EMAIL=~/.mail
+IGNORE="(Spam|trash|Important)"
+
+if [ "$1" == "-s" ]; then
+ V=n
+else
+ V=y
+fi
+
+for account in $(ls "$EMAIL"); do
+ cd $EMAIL/$account
+ COUNT="0"
+ COUNT=$(find . -name new -type d -print0 |
+ while read -d $'\0' folder; do
+ if [ -n "`echo $folder | grep -E $IGNORE`" ]; then
+ continue
+ fi
+ directory=$(echo $folder | sed 's/^\.\///' | sed 's/\/new$//')
+ count=$(ls "$folder" | wc -l)
+ if [ "$count" -gt "0" ]; then
+ if [ $V == 'y' ]; then
+ echo "$account/$directory: $count"
+ else
+ let 'COUNT = COUNT + count'
+ echo $COUNT
+ fi
+ fi
+ done | tail -1)
+ if [ -n "$COUNT" ]; then
+ if [ $V == "n" ]; then
+ echo "$account:$COUNT"
+ else
+ echo $COUNT
+ fi
+ fi
+done