Ce produit n'est pas pris en charge par le site Datadog que vous avez sélectionné. ().
Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

Metadata

ID: bash-code-quality/useless-cat

Language: Bash

Severity: Notice

Category: Code Style

Description

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
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Intégrations fluides. Essayez Datadog Code Security