pass stdout as file name for command line util?

前端 未结 5 2092
醉酒成梦
醉酒成梦 2020-11-30 03:23

I\'m working with a command line utility that requires passing the name of a file to write output to, e.g.

foo -o output.txt

The only thing

5条回答
  •  时光说笑
    2020-11-30 03:43

    You could use the magic of UNIX and create a named pipe :)

    1. Create the pipe

      $ mknod -p mypipe
      
    2. Start the process that reads from the pipe

      $ second-process < mypipe
      
    3. Start the process, that writes into the pipe

      $ foo -o mypipe
      

提交回复
热议问题