useless-cat
What it does
Section titled “What it does”Reports a pipeline that starts with cat file.
Why it matters
Section titled “Why it matters”cmd < file does the same without a process and a pipe, and gives the command a file it can seek in.
To fix, write cmd < file, or pass the file as an argument.
Example
Section titled “Example”cat in.txt | grep xcat -n in.txt | grep xcat a b | grep xgrep x in.txt...Configuration
Section titled “Configuration”shell: lint: rules: useless-cat: warn # off (default), warn, errorEnabled by the presets: shell/shellcheck.
Suppress one line with sudsy-disable-next-line useless-cat 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 | SC2002 |
full |