aboutsummaryrefslogtreecommitdiff
path: root/unread-mails
blob: 2614e354c157795d01aca564f6179bd40dbd3e98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
#
# Count number of unread email messages.
#

# Setup
MAIL="$HOME/mail"
INBOX="$MAIL/INBOX"

# Check
if [ ! -d "$INBOX" ]; then
  exit
fi

# Calculate
TOTAL="`find $MAIL -maxdepth 2 -name 'new' -exec ls {} \; | wc -l`"

# Print
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