Skip to content
Vidar Holen edited this page Oct 4, 2015 · 4 revisions

Don't put spaces around the = in assignments.

Problematic code:

foo = 42

Correct code:

foo=42

Rationale:

Shells are space sensitive. foo=42 means to assign 42 to the variable foo. foo = 42 means to run a command named foo, and pass = as $1 and 42 as $2.

Exceptions

If you actually wanted to run a command named foo and provide = as the first argument, simply quote it to make ShellCheck be quiet: foo "=" 42.

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