4

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?

Michael Mrozek
  • 93,103
  • 40
  • 240
  • 233

1 Answers1

15

echo doesn't use stdin, try using cat

echo 1 | cat

or

echo 1 | xargs echo
Cliff
  • 251