Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

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

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

1 Answer 1

echo doesn't use stdin, try using cat

echo 1 | cat

or

echo 1 | xargs echo
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.