diff options
| author | Erik Cervin-Edin <erik.cervin-edin@einride.tech> | 2025-11-03 17:44:28 +0100 |
|---|---|---|
| committer | Erik Cervin-Edin <erik.cervin-edin@einride.tech> | 2025-11-03 18:06:29 +0100 |
| commit | 3a36c660e17df6296b8f042772780764f0e9a7d2 (patch) | |
| tree | 97751c39f708d356caf756ba8351ad11c776165f | |
| parent | b7b7f21d692048f34287615312ebc9385cd3c378 (diff) | |
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.
| -rwxr-xr-x | bin/mailsync | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/mailsync b/bin/mailsync index 3a681f0..7114836 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -74,7 +74,7 @@ syncandnotify() { [ -z "$MAILSYNC_MUTE" ] && for file in $new; do # Extract and decode subject and sender from mail. - subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | head -n-1 | + subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | sed '$d' | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | tr -d '\n\t') from="$(sed -n "/^From:/ s|From: *|| p" "$file" | |
