aboutsummaryrefslogtreecommitdiff
path: root/unread-mails
blob: 75c7aaf2b7975826f3aad853178a6235dabce3ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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