From d1dd8bab6236f22d50b46d567d9f049a31950f35 Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Sun, 26 May 2024 12:00:52 -0400 Subject: [PATCH] Tweak logic --- scripts/ewp-send-new-mail-summary | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/ewp-send-new-mail-summary b/scripts/ewp-send-new-mail-summary index decc19c..5f1ecb3 100755 --- a/scripts/ewp-send-new-mail-summary +++ b/scripts/ewp-send-new-mail-summary @@ -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}"