Skip to content
Mingye Wang edited this page Oct 4, 2015 · 8 revisions

You need a space here

Problematic code:

if ![-z foo ]; then true; fi # if the command `[-z' with args `foo', `]' is not successful..

Correct code:

if ! [ -z foo ]; then true; fi # if the command `[' with args `-z'. `foo', `]' is not sucessful..

Rationale:

Bourne shells are very whitespace sensitive. Adding or removing spaces can drastically alter the meaning of a script. In these cases, ShellCheck has noticed that you're missing a space at the position indicated.

Exceptions

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