Diff output from two programs without temporary files

后端 未结 6 939
梦谈多话
梦谈多话 2021-01-29 18:13

Say I have too programs a and b that I can run with ./a and ./b.

Is it possible to diff their outputs without first w

6条回答
  •  悲哀的现实
    2021-01-29 19:12

    One option would be to use named pipes (FIFOs):

    mkfifo a_fifo b_fifo
    ./a > a_fifo &
    ./b > b_fifo &
    diff a_fifo b_fifo
    

    ... but John Kugelman's solution is much cleaner.

提交回复
热议问题