OS X / Linux: pipe into two processes?

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

I know about

program1 | program2

and

program1 | tee outputfile | program2

but is there a way to feed prog

6条回答
  •  猫巷女王i
    2020-11-27 16:08

    The bash manual mentions how it emulates the >(...) syntax using either named pipes or named file descriptors, so if you don't want to depend on bash, perhaps you could do that manually in your script.

    mknod FIFO
    program3 < FIFO &
    program1 | tee FIFO | program2
    wait
    rm FIFO
    

提交回复
热议问题