From b4c3421b399e8197640f264a527365afb5471c3c Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 8 Aug 2017 09:20:44 -0300 Subject: Add unread-mails --- unread-mails | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 unread-mails 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 -- cgit v1.2.3