iterate-find-output
What it does
Section titled “What it does”Reports a for loop over the output of find.
Why it matters
Section titled “Why it matters”The output is split on blanks and globbed, so a file name with a space is cut into several items, and one with a * or ? expands to other names.
To fix, use find ... -exec, or find ... -print0 | while IFS= read -r -d '' f, or a glob (for f in ./*).
Example
Section titled “Example”...for f in *.txt; do :; donefor f in $(find . -name x); do :; done...find . -print0 | xargs -0 rmfind . | xargs -0 rm...Configuration
Section titled “Configuration”shell: lint: rules: iterate-find-output: warn # off, warn (default), errorEnabled by the presets: shell/shellcheck.
Suppress one line with sudsy-disable-next-line iterate-find-output in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| shellcheck | SC2044 |
full |