On Fri, Jan 29, 2021 at 12:33:17AM +0100, Jean-Jacques Brucker wrote:
> $ echo "dc30a6d79f3b47e310b8b9f5fbadba57" | tee >( xxd  -r -p | base64) |
> tee >(xxd  -r -p | basenc --base64url )
> dc30a6d79f3b47e310b8b9f5fbadba57
> 3DCm1587R+MQuLn1+626Vw==
> 3DCm1587R-MQuLn1-626Vz0Vhw==

Yes, there is a race condition bug, but it's in your script, not in bash.

You've launched two simultaneous background jobs (the process subs),
and they are both writing to the same place (your terminal).  You
should expect their output to be interleaved unpredictably.

If you want the two outputs to be separate, you need to write them to
different places, and then merge them afterward -- either that, or
run the two output-producing processes in series instead of in parallel.


Reply via email to