POSIX Is Not a Shell
7 hours ago
- #shell scripting
- #portability
- #POSIX compliance
- POSIX is a specification, not a shell; actual scripts run on implementations like bash, dash, or ksh.
- Example: 'echo "C:\new"' shows differences in handling backslash escapes across shells, illustrating that POSIX leaves some behaviors implementation-defined.
- Many shell features are consistent, but key ones like 'echo', 'local', and '[[ ]]' vary, often due to historical decisions or non-POSIX extensions.
- Portability requires testing across real shell versions, not just assuming compliance; distributions use different shells for /bin/sh, like dash, bash, or busybox ash.
- Tools like shell-docs automate verification across multiple shells, making 'POSIX compliant' claims concrete and testable.