When cat reads one path and its output is piped to another command, the cat step is usually redundant.
Pass the file path to that command or use shell redirection instead.
Non-Compliant Code Examples
#!/bin/bash
cat file.txt | grep pat
cat ./x | wc -l
/bin/cat foo | head
Compliant Code Examples
#!/bin/bash
grep pat file.txt
cat file.txt
cat a b | wc
cat -n file.txt | head
cat - | wc
cat -- file | wc
シームレスな統合。 Datadog Code Security をお試しください
Datadog Code Security
このルールを試し、Datadog Code Security でコードを解析する
このルールの使用方法
1
2
rulesets:- bash-code-quality # Rules to enforce Bash code quality.