SC2042
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"
doneCorrect code:
for f in foo bar baz
do
echo "$f"
doneRationale:
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!