For command

echo 'from pipe'|(cat <<< 'from input redirect')  

output is

from input redirect

What happens to the line 'from pipe' coming from echo?

  • It's probably discarded, as there can only be one standard input (at a time). – DopeGhoti Sep 27 '17 at 21:20

It will be sitting unused in an output buffer and discarded when both commands have exited.

If the left hand side produces enough data to fill the output buffer, it will temporarily pause until the buffer has been consumed. Since this won't happen here, it would eventually get a SIGPIPE signal and die from a "broken pipe" as soon as the right hand side command terminated. It may also catch the SIGPIPE signal specifically and exit gracefully.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.