aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-08-08 09:20:44 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-08-08 09:20:44 -0300
commitb4c3421b399e8197640f264a527365afb5471c3c (patch)
tree1ca489abe36e70f61ec2fd12c981486833c8cf5a
parent3b6f6cae53ca8caf8852c416d8e1a489cd7f7ff0 (diff)
downloadutils-mail-b4c3421b399e8197640f264a527365afb5471c3c.tar.gz
utils-mail-b4c3421b399e8197640f264a527365afb5471c3c.tar.bz2
Add unread-mails
-rwxr-xr-xunread-mails20
1 files changed, 20 insertions, 0 deletions
diff --git a/unread-mails b/unread-mails
new file mode 100755
index 0000000..75c7aaf
--- /dev/null
+++ b/unread-mails
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Count number of unread email messages.
+#
+
+# Setup
+MAIL="$HOME/mail"
+
+# Check
+if [ ! -d "$MAIL" ]; then
+ exit
+fi
+
+# Calculate
+TOTAL="`find $MAIL -maxdepth 2 -name 'new' -exec ls {} \;`"
+
+# Print
+if [ ! -z "$TOTAL" ] && [ "$TOTAL" != "0" ]; then
+ echo $TOTAL unread emails.
+fi