mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC2008 (markdown)
19
SC2008.md
Normal file
19
SC2008.md
Normal file
@@ -0,0 +1,19 @@
|
||||
## echo doesn't read from stdin, are you sure you should be piping to it?
|
||||
|
||||
### Problematic code:
|
||||
|
||||
find . | echo
|
||||
|
||||
### Correct code:
|
||||
|
||||
find .
|
||||
|
||||
### Rationale:
|
||||
|
||||
You are piping command output to `echo`, but `echo` ignores all piped input.
|
||||
|
||||
In particular, `echo` is not responsible for putting output on screen. Commands already output data, and with no further actions that will end up on screen.
|
||||
|
||||
### Exceptions:
|
||||
|
||||
None.
|
Reference in New Issue
Block a user