Tweak logic
This commit is contained in:
parent
53b6200c60
commit
d1dd8bab62
@ -9,6 +9,7 @@ fi
|
||||
|
||||
# Read a list of all new mail
|
||||
new_mail=$(mail -H | grep "^.N")
|
||||
new_mail_count=$(echo "$new_mail" | wc -l | tr -d ' ')
|
||||
|
||||
# If this list is empty, exit
|
||||
if [ -z "$new_mail" ]; then
|
||||
@ -17,8 +18,8 @@ if [ -z "$new_mail" ]; then
|
||||
fi
|
||||
|
||||
# Make sure to mark all new mail as "unread" so we don't get in a loop.
|
||||
echo "q" | mail -N
|
||||
echo "q" | mail -N > /dev/null
|
||||
|
||||
# Otherwise, we can continue to process the new mail
|
||||
echo "Found $(echo "$new_mail" | wc -l) new peices of mail"
|
||||
echo "You have new mail waiting for you on $(hostname).\n\n${new_mail}" | mail -s "New mail on $(hostname)" "${1}"
|
||||
echo "Found ${new_mail_count} new peices of mail"
|
||||
echo -e "You have new mail waiting for you on $(hostname):\r\n\r\n${new_mail}" | mail -s "New mail on $(hostname)" "${1}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user