I put this command into bash, expecting it to print FOO
and then wait for more input:
(echo FOO; cat) | grep FOO | cat
Instead it prints nothing, and waits until I press Ctrl+D before anything appears.
If I remove the |cat
at the end, the issue goes away.
What is going on here? Is grep waiting for more lines, and only when piped to something else? Or is bash/cat waiting?