Skip to content
Vidar Holen edited this page Oct 20, 2022 · 1 revision

Use spaces, not commas, to separate loop elements.

Problematic code:

for f in foo,bar,baz
do
  echo "$f"
done

Correct code:

for f in foo bar baz
do
  echo "$f"
done

Rationale:

ShellCheck found a for loop where the items appeared to be delimited by commas. These will be treated as literal commas. Use spaces instead.

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 SC1000. Use GitHub Wiki's "Pages" feature guerraart8 to find a specific , or see Checks.

Clone this wiki locally