4

This question already has an answer here:

Why doesn't this command output "1"?

echo 1 | echo

I imagine it working this way:

1. echo 1 (outputs 1)
2. | echo (takes the 1 as an input, then echos it)

Isn't this what should happen?

marked as duplicate by Stéphane Chazelas, Jeff Schaller, phk, Sparhawk, Rui F Ribeiro May 27 '17 at 14:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from stackoverflow.com Nov 19 '11 at 1:49

This question came from our site for professional and enthusiast programmers.

15

echo doesn't use stdin, try using cat

echo 1 | cat

or

echo 1 | xargs echo