aboutsummaryrefslogtreecommitdiff
path: root/unread-mails
diff options
context:
space:
mode:
Diffstat (limited to '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