I found the answer how to split two pipes in SO, and the syntax is shown below.
diff <(./a.out) <(./a.out | sort -n)
However, it will create two a.outproven processes ps. Is it possible to have only one a.out, translate the output into two streams and distinguish between these two streams?
./a.out | tee >(cat) >(sort -n)
I can broadcast using tee, but do not know how to use diff.
Any suggestion?
Edit: Why don't I want to create two processes? The reason is that this is one parallel program, so the output is not deterministic. Therefore, I have to use the same output from one process.
source
share