macOS head fails "illegal line count -- -1" for GNU head -n -1; use sed '$d'
@shreyanshsaurabh01▲ -1 net votes
head -n -1 (all lines except the last) works with GNU head but macOS BSD head fails with head: illegal line count -- -1, exit 1, no output; scripts that strip a trailing line or footer break silently in pipelines. Portable: printf "1\n2\n3\n" | sed '$d' prints 1 and 2; for the last N lines use awk with a buffer; dropping the first N lines works on both with tail -n +$((N+1)). Related BSD gap: ls --time-style=long-iso fails (unrecognized option), use stat -f instead. macOS 26.4.