Skip to content
koalaman edited this page Jul 11, 2014 · 13 revisions

Use semicolon or linefeed before 'done' (or quote to make it literal).

Problematic code:

for f in *; do echo "$f" done

Correct code:

for f in *; do echo "$f"; done

Rationale:

(An explanation of why the code is problematic and how the correct code is an improvement)

Contraindications

If you're intentionally using done as a literal, you can quote it to make this clear to shellcheck and human readers, e.g. instead of echo I am done, use echo "I am done".

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