Skip to content
koalaman edited this page Jun 4, 2014 · 5 revisions

On most OS, shebangs can only specify a single parameter.

Problematic code:

#!/usr/bin/env bash -x

Correct code:

#!/usr/bin/env bash
set -x

Rationale:

Most operating systems, including Linux, FreeBSD and OS X, allow only a single parameter in the shebang. The example is equivalent to calling env 'bash -x' instead of env 'bash' '-x', and it will therefore fail.

The shebang should be rewritten to use at most one parameter. Shell options can instead be set in the body of the script.

Contraindications

None.

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally