mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2202 (markdown)
@@ -22,9 +22,9 @@ done
|
||||
|
||||
Globs in `[ ]` will expand to a sequence of words, one per matching filename. Meanwhile, operators work on single words.
|
||||
|
||||
The problematic code is equivalent to `[ current.log -nt backup/file1.log backup/file2.log backup/file3.log ]`, which is invalid syntax.
|
||||
The problematic code is equivalent to `[ current.log -nt backup/file1.log backup/file2.log backup/file3.log ]`, which is invalid syntax. A typical error message is `bash: [: too many arguments` or `dash: somefile: unexpected operator`.
|
||||
|
||||
Instead, you can iterate over the filenames you want with a loop, and apply your condition to each filename.
|
||||
Instead, use a `for` loop to iterate over matching filenames, and apply your condition to each.
|
||||
|
||||
### Exceptions:
|
||||
|
||||
|
Reference in New Issue
Block a user