From ffea22b0433b02092aa4cb3c14bf3f1eb7569e6d Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 8 Aug 2017 11:48:13 -0300 Subject: Get number of dangling mails at INBOX --- unread-mails | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/unread-mails b/unread-mails index 75c7aaf..37f3a97 100755 --- a/unread-mails +++ b/unread-mails @@ -5,6 +5,7 @@ # Setup MAIL="$HOME/mail" +INBOX="$MAIL/INBOX" # Check if [ ! -d "$MAIL" ]; then @@ -12,9 +13,17 @@ if [ ! -d "$MAIL" ]; then fi # Calculate -TOTAL="`find $MAIL -maxdepth 2 -name 'new' -exec ls {} \;`" +TOTAL="`find $MAIL -maxdepth 2 -name 'new' -exec ls {} \; | wc -l`" # Print -if [ ! -z "$TOTAL" ] && [ "$TOTAL" != "0" ]; then +if [ "$TOTAL" != "0" ]; then echo $TOTAL unread emails. fi + +# Current on INBOX +TOTAL="`ls -1 $INBOX/cur/ | wc -l`" + +# Print +if [ "$TOTAL" != "0" ]; then + echo $TOTAL mails dangling at the INBOX. +fi -- cgit v1.2.3