Skip to content
Joachim Ansorg edited this page Nov 12, 2021 · 3 revisions

Semicolons directly after else are not allowed. Just remove it.

Problematic code:

if mycommand; then echo "True"; else; echo "False"; fi

Correct code:

if mycommand; then echo "True"; else echo "False"; fi

Rationale:

else keywords should not be followed by semicolons. It's not valid shell syntax.

You can follow them directly with a line break or another command.

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