SC2042 – ShellCheck Wiki

See this page on GitHub

Sitemap


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


ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.