My question is related to https://serverfault.com/questions/171095/how-do-i-join-two-named-pipes-into-single-input-stream-in-linux but with a slightly more convoluted setup.
I have three programs, cmd1
, cmd2
and cmd3
;
cmd1
takes no input and writes to stdout
cmd2
reads stdin or a given file and writes to stdout
cmd3
reads two files
The dataflow for these programs is the following: cmd2
consumes data produced by cmd1
, and cmd3
consumes data produced by both cmd1
and cmd2
:
cmd1 ---+-----> cmd2 --->
| cmd3
+--------------->
How can I achieve this dataflow with a single command line using >(), pipes and tee
?
My best guess is cmd1 | tee >(cmd2) > >(cmd3)
.