grep-count
What it does
Section titled “What it does”Reports a pipeline from grep into wc -l.
Why it matters
Section titled “Why it matters”grep -c counts the matching lines in one process and has no pipe.
To fix, write grep -c.
Example
Section titled “Example”...trap "echo bye" EXIT...grep x f | wc -l...[ -n x ] && (a || b)a && ba || b && cls -l | grep txt | wc -l...Configuration
Section titled “Configuration”shell: lint: rules: grep-count: warn # off (default), warn, errorEnabled by the presets: shell/shellcheck.
Suppress one line with sudsy-disable-next-line grep-count in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| shellcheck | SC2126 |
partial | Only a pipeline that is the grep and the wc -l. |