Shell Script Portability Checker (Bashisms in #!/bin/sh)

Check a script for features that break when /bin/sh is dash, ash or busybox, with the POSIX replacement for each.

Use the tool

Why this tool exists

A list of patterns similar to checkbashisms is applied line by line: double brackets, "function" definitions, arrays, here-strings, process substitution, bash parameter expansions, $RANDOM and other bash variables, echo -e/-n, brace sequences, select, (( )) arithmetic, == inside single brackets and more. The shebang is read so that scripts declared as bash are not alarmed.

It is pattern based, so it can miss subtle cases and flag a few valid POSIX lines. Confirm with dash -n script.sh, run the script under dash, and use ShellCheck for deeper analysis.

No data is sent anywhere: the work happens in your browser, so you can use it offline once the page has loaded.

How to use it

  1. Paste the script with its shebang line.
  2. Run the check.
  3. Replace each flagged construct with its POSIX equivalent or change the shebang to bash.
  4. Test under dash.

Frequently asked questions

Is "local" a bashism?

It is not in POSIX, but dash, ash and busybox support it. The tool notes it.

What is the shebang for portability?

#!/bin/sh with only POSIX features, or #!/usr/bin/env bash if you need bash.

Can it replace ShellCheck?

No. ShellCheck is far more thorough.

Is my data sent anywhere?

No. Everything is processed in your browser, and the page makes no network requests with your input.