As in the title, how can I compare stdout
& stderr
of a program using diff
on a terminal (without using temporary files or named pipes)?
Put more generally, I would like to do something like this
(stdout) | <program B>
/ \
<program A> <diff> - terminal
\ /
(stderr) | <program C>
I thought that I could achieve the task in a similar manner to this. It suggests several options, which include
1. using temp files
foo | bar > file1.txt && baz | quux > file2.txt && diff file1.txt file2.txt
I don't want to use temp files :(
2. using process substitution
diff <(foo | bar) <(baz | quux)
It compares two streams (both stdout) from different commands using the file descriptor trick. What I want is to compare two streams of a single command, which could not be done with the trick...
3. using named pipe
mkfifo file1_pipe.txt
foo|bar > file1_pipe.txt && baz | quux | diff file1_pipe.txt - && rm file1_pipe.txt
I want named pipe neither :(
EDIT: Sorry for being a bit unclear on my intention of the question. My interest was to see the capability of bash (or other shells) to handle complex steam redirections.