[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: process substitution stdout connected to pipeline
From: |
Greg Wooledge |
Subject: |
Re: process substitution stdout connected to pipeline |
Date: |
Fri, 13 Feb 2015 12:18:31 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Fri, Feb 13, 2015 at 05:10:42PM +0000, Pádraig Brady wrote:
> bash though seems to connect the stdout of the process substitution
> to the pipeline, which seems like a bug:
> $ : | tee >(md5sum) | sha1sum
> 253a7a49edee354f35b2e416554127cf29c85724 -
md5sum inherits the anonymous pipe to sha1sum as its stdout, because
that's how child processes work. I don't see it as an error in bash,
but rather in the script. You might want a construction like:
: | tee >(md5sum >&2) | sha1sum
Then you have md5sum writing to bash's stderr, and sha1sum writing to
bash's stdout. Or you could get fancier with things like 3>&1.