Skip to content
Joachim Ansorg edited this page Oct 31, 2022 · 2 revisions

Semicolon is not allowed directly after do. You can just delete it.

Problematic code:

while true; do; true; done

while true;
do;
  true;
done;

Correct code:

while true; do true; done

while true;
do
  true;
done;

Rationale:

Semicolon ; is not allowed directly after a do keyword. Follow it directly with either a command or a linefeed as shown in the example.

Exceptions:

None.

Related resources:

  • Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!

ShellCheck

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

Clone this wiki locally