Create a pipe that writes to multiple files (tee)

后端 未结 5 1694
情话喂你
情话喂你 2021-02-09 14:52

I would like to create a pipe in a ksh script (using exec) that pipe\'s to a tee, and sends the output to a pipe.

Current:

#Redirect EVE         


        
5条回答
  •  孤城傲影
    2021-02-09 15:11

    I know bash not ksh, but there's a lot of overlap, so maybe this will work there too.

    process1 N> >(process2)
    

    Creates a subshell running process2. That subshell receives as its stdin the data from process1's file descriptor N. So in particular, you could do:

    process1 1> >(tee -a mylog >&3)
    

    I don't know whether this would also work if process1 is replaced with exec, but you could give it a try.

提交回复
热议问题