bashism
A bash-only feature, such as [[ ]], arrays, (( )) or process substitution, used in a script that claims to be POSIX sh.
In more detail
It works when /bin/sh happens to be bash, as on macOS, and fails under dash or ash on Debian, Ubuntu and Alpine. Either change the shebang to bash or rewrite the feature in POSIX form, and check with ShellCheck or by running the script under dash.
Related terms
- sh — The standard Unix shell name: whatever program /bin/sh points to, expected to behave as the POSIX standard describes.
- POSIX — A standard that describes the commands, shell and programming interface a Unix-like operating system should offer.
- Debian Almquist shell — A small, fast POSIX shell, called dash, that Debian and Ubuntu use as /bin/sh.
- ShellCheck — A linter for shell scripts that reports quoting mistakes, portability problems and common bugs, each with a numbered code.
Taught in
- POSIX sh Versus Bash — Bash Scripting & Command Line Automation