]> gitweb.fluxo.info Git - utils-mail.git/commitdiff
Get number of dangling mails at INBOX
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 8 Aug 2017 14:48:13 +0000 (11:48 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 8 Aug 2017 14:48:13 +0000 (11:48 -0300)
unread-mails

index 75c7aaf2b7975826f3aad853178a6235dabce3ec..37f3a9732c285610f84e3ee6cd46f943969e32ca 100755 (executable)
@@ -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