diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-08-08 11:48:13 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-08-08 11:48:13 -0300 |
commit | ffea22b0433b02092aa4cb3c14bf3f1eb7569e6d (patch) | |
tree | 25371eebc86f1bbd1a49e4d1e7566b60da912ee7 | |
parent | b4c3421b399e8197640f264a527365afb5471c3c (diff) | |
download | utils-mail-ffea22b0433b02092aa4cb3c14bf3f1eb7569e6d.tar.gz utils-mail-ffea22b0433b02092aa4cb3c14bf3f1eb7569e6d.tar.bz2 |
Get number of dangling mails at INBOX
-rwxr-xr-x | unread-mails | 13 |
1 files 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 |