Skip to content

Commit 3a36c66

Browse files
committed
Replace head -n-1 with POSIX-compatible sed '$d'
The GNU-specific head -n-1 syntax causes errors on macOS/BSD systems. Replaced with sed '$d' which is POSIX-compatible and achieves the same result of removing the last line.
1 parent b7b7f21 commit 3a36c66

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎bin/mailsync‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ syncandnotify() {
7474
[ -z "$MAILSYNC_MUTE" ] &&
7575
for file in $new; do
7676
# Extract and decode subject and sender from mail.
77-
subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | head -n-1 |
77+
subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | sed '$d' |
7878
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' |
7979
sed 's/^Subject: //' | tr -d '\n\t')
8080
from="$(sed -n "/^From:/ s|From: *|| p" "$file" |

0 commit comments

Comments
 (0)