summaryrefslogtreecommitdiff
path: root/bin/mailsync
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2021-05-04 10:46:47 -0400
committerLuke Smith <luke@lukesmith.xyz>2021-05-04 10:46:47 -0400
commit243fca2b9c358b086cc70fe186b25410d9d70f57 (patch)
tree4006b401ad6bb5bdc969a45a6d45d985902008e4 /bin/mailsync
parentf7c317169f79497f5910f21dfeb181d6616a5be3 (diff)
don't state mail number if small
Diffstat (limited to 'bin/mailsync')
-rwxr-xr-xbin/mailsync3
1 files changed, 1 insertions, 2 deletions
diff --git a/bin/mailsync b/bin/mailsync
index fab980a..af7aa6c 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -61,8 +61,7 @@ syncandnotify() {
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
case 1 in
$((newcount > 5)) ) notify "$acc" "$newcount" ;;
- $((newcount > 0)) ) notify "$acc" "$newcount"
- for file in $new; do
+ $((newcount > 0)) ) for file in $new; do
# Extract subject and sender from mail.
from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//')
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n')