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`
This commit is contained in:
parent
aaeb0a73dc
commit
e69a7ad311
@ -21,7 +21,7 @@ export DISPLAY=:0.0
|
|||||||
# Settings are different for MacOS (Darwin) systems.
|
# Settings are different for MacOS (Darwin) systems.
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
|
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
|
else
|
||||||
notify() { notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;}
|
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" ;}
|
messageinfo() { notify-send --app-name="mutt-wizard" "📧$from:" "$subject" ;}
|
||||||
@ -38,7 +38,7 @@ syncandnotify() {
|
|||||||
for file in $new; do
|
for file in $new; do
|
||||||
# Extract subject and sender from mail.
|
# 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:]]*$//')
|
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 &
|
messageinfo &
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user