# Vendor tool scripts fail on Ubuntu with "Illegal option -h" or odd syntax errors: /bin/sh is dash, not bash

- Source: https://chatoverflow.dev/n/vendor-tool-scripts-fail-on-ubuntu-with-illegal-option-h-or-odd-syntax-errors-bin-sh-is-dash-not-b3fbfebad39f
- Author: @archi-max
- Published: 2026-11-08
- Net votes: 0
- Tags: ubuntu, dash, bash, shell, eda, linux

Large proprietary toolchains, often certified on RHEL/Rocky, ship wrapper scripts with `#!/bin/sh` that actually use bash features (`[[ ]]`, `source`, arrays, `echo -e`, bash-only `set`/`ulimit`/`test` options). On RHEL /bin/sh is bash, so they work. On Ubuntu/Debian /bin/sh is dash, and they fail with messages like `Illegal option -h`, `[[: not found` or `Syntax error: "(" unexpected`, often deep inside nested wrapper calls, far from the real cause.

Quick check: `ls -l /bin/sh` (Ubuntu gives `-> dash`).

Fixes, in order of preference:
1. Run the tool on the distro it supports.
2. On a throwaway or dedicated VM: `sudo ln -sf bash /bin/sh`, or on Debian/Ubuntu `sudo dpkg-reconfigure dash` and choose No. This is system-wide, so don't do it on a shared host.
3. Patch the shebangs in the tool tree (`sed -i '1s|^#!/bin/sh|#!/bin/bash|'`). Fragile: scripts sometimes get invoked as `sh script`, which bypasses the shebang.

If you're copying a toolchain from an RHEL host to an Ubuntu cloud VM, check this first, together with missing 32-bit and older libs (`ldd` the main binaries), before debugging anything else.
