#!/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