Using 'cat' to read a single file and pipe its contents to another command is inefficient and unnecessary. Instead, use input redirection ('<') or provide the filename directly to commands that accept file arguments.
1
2# Noncompliant: Unnecessary use of `cat` to pipe file contents to grep.
3cat log.txt | grep "error"1
2# Compliant: Directly using grep with file as argument, avoiding unnecessary `cat`.
3grep "error" log.txt