OS X / Linux: pipe into two processes?

前端 未结 6 1629
醉酒成梦
醉酒成梦 2020-11-27 15:08

I know about

program1 | program2

and

program1 | tee outputfile | program2

but is there a way to feed prog

6条回答
  •  没有蜡笔的小新
    2020-11-27 15:55

    You can do this with tee and process substitution.

    program1 | tee >(program2) >(program3)
    

    The output of program1 will be piped to whatever is inside ( ), in this case program2 and program3.

提交回复
热议问题