summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authoralps2006 <guoxiangxun@gmail.com>2020-05-27 10:02:20 +0800
committerGitHub <noreply@github.com>2020-05-26 22:02:20 -0400
commite69a7ad311e94c29a1e4b7e593a8630b09573ea2 (patch)
tree2dc93fc7ea3ada118b2e66dda71a1c1ccc8937cf /bin
parentaaeb0a73dc0904f9258743683e96e2439f88ba56 (diff)
Fix head: illegal line count -- -1 (#443)
* Fix head: illegal line count -- -1 * Fix `osascript: display notification with title "📧 xxxx" subtitle "xxxx" : No such file or directory`
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mailsync4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/mailsync b/bin/mailsync
index 3104c65..6aeb946 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -21,7 +21,7 @@ export DISPLAY=:0.0
# Settings are different for MacOS (Darwin) systems.
if [ "$(uname)" = "Darwin" ]; then
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
- messageinfo() { osascript "display notification with title \"📧 $from\" subtitle \"$subject\"" ;}
+ messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;}
else
notify() { notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;}
messageinfo() { notify-send --app-name="mutt-wizard" "📧$from:" "$subject" ;}
@@ -38,7 +38,7 @@ syncandnotify() {
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')
+ 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')
messageinfo &
done
fi