Proposal for multi-redirecting stdout & stderr to different programs
Here I am proposing to the entire Linux community that OS designer might consider doing this:
the stdio's pipe operator '|' should work the same as '>', and should support multi-pipe,
for example,
MyProgramA 1>A_stdout.txt 2>A_stderr.txt 1>A_stdout2.txt 2>B_stderr2.txt 1|MyProgramB 1|MyProgramC 2|MyProgramD
the standard output from MyProgramA is written into 2 files A_stdout.txt and A_stdout2.txt , in addition, it's piped into MyProgramB and MyProgramC, its error output is piped into MyProgramD
However, one problem of this design is that if there are multiple '|'s, there'll be ambiguity on the 2nd and subsequent '|'s, i.e. do you want to pipe the stdout/err from the 1st program or the 2nd program? Maybe we can bracket them i.e.
MyProgramA 1|(MyProgramB 1>B.stdout 2>B.stderr) 2|(MyProgramC 1>C.stdout 2>C.stderr)
In fact, multi-pipe is not required if we use the command 'tee',
but is simpler, because instead of writing:
MyProgram | tee file1 | tee file2 | tee file3 >file4
we can write:
MyProgram 1>file1 1>file2 1>file3 1>file4
What do you guys think?:D
Wang Xuancong