diff --git a/SC2042.md b/SC2042.md new file mode 100644 index 0000000..0f83803 --- /dev/null +++ b/SC2042.md @@ -0,0 +1,30 @@ +## Use spaces, not commas, to separate loop elements. + +### Problematic code: + +```sh +for f in foo,bar,baz +do + echo "$f" +done +``` + +### Correct code: + +```sh +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! \ No newline at end of file