Fix macOS compatibility in kiwix torrent sync script

BSD head (macOS) doesn't support negative line counts like GNU head.
Use `sed '$d'` instead of `head -n -1` to remove the last line.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-01-16 22:36:28 -08:00
commit 53a0bf5813

View file

@ -16,7 +16,8 @@ if [[ ! -f "$TORRENT_LIST" ]]; then
fi
# Get current torrents from transmission (extract names, skip header/footer)
current_torrents=$(transmission-remote -l 2>/dev/null | tail -n +2 | head -n -1 | awk '{print $NF}' || true)
# Note: Use sed '$d' instead of head -n -1 for macOS compatibility
current_torrents=$(transmission-remote -l 2>/dev/null | tail -n +2 | sed '$d' | awk '{print $NF}' || true)
added=0
skipped=0