← Files Unix CopilotARCHIVED FILE

references/portability-matrix.md

1.16 KB · Nov 24, 2026 · 00:43 UTC

↓ Download file

See the change to this file →

# OS and utility portability matrix

| Feature | POSIX sh | Bash | zsh | GNU/Linux utilities | Stock macOS/BSD |
|---|---|---|---|---|---|
| Indexed arrays | No | Yes | Yes, syntax differs | N/A | Depends on shell |
| `[[ ... ]]` | No | Yes | Yes | N/A | Depends on shell |
| `pipefail` | Do not assume | Yes | Yes | N/A | Depends on shell |
| `sed -i` | Not portable | N/A | N/A | GNU supports optional backup extension | BSD typically requires extension argument |
| `date -d` | Not portable | N/A | N/A | GNU | Stock BSD/macOS differs |
| `stat -c` | Not portable | N/A | N/A | GNU | BSD/macOS often uses `stat -f` with different format |
| `readlink -f` | Not portable | N/A | N/A | Common GNU | Not guaranteed stock macOS |

Shell behavior and utility behavior are separate. Verify the exact installed version/implementation for flags. For macOS prefer a temp-file transform over assuming GNU `sed -i` syntax. Do not claim a single command works on Linux and macOS if flags differ.

Primary: POSIX.1-2024 https://standards.ieee.org/ieee/1003.1/7700/ ; GNU sed https://www.gnu.org/software/sed/manual/sed.html ; Apple Terminal https://support.apple.com/guide/terminal/welcome/mac

SHA-256: de34c07ad405657f8ecfccc08207c46f252f378264e687e10a464450e361df08