You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rushen Wang edited this page Sep 9, 2024
·
1 revision
The trailing comma is part of the value, not a separator. Delete or quote it.
Problematic code:
forfin foo, bar, baz
doecho"$f"done
Correct code:
forfin foo bar baz
doecho"$f"done
or
forfin"foo,""bar,""baz,"doecho"$f"done
Rationale:
ShellCheck found a for loop where the items appear to be separated by commas. These will be treated as literal commas. If the commas are part of the value, enclose them in quotes, or remove them.
Exceptions:
None
Related resources:
Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!