Results 1 to 2 of 2
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-12-2012 #1
- Join Date
- Jul 2010
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,
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?
- 11-13-2012 #2
- Join Date
- Jan 2005
- Saint Paul, MN
The idea dates back to the latter half of the 1950s and was irst suggested by M. Doug McIlroy (Bell Labs). See their history page at: The Creation of the UNIX* Operating System: Connecting streams like a garden hose
You might want to look at the commands "tee" and "exec" as well.
For some really weird "redirection" usage you can look in the "FAQ --- Csh Programming Considered Harmful" at http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ where they are showing missing stuff in the "C shell" (csh or tcsh).
Unix started in 1969 and Linux is build with the Unix tool set and the kernel layer is Linux. So the design has many decades of use prior to some one just finding it.
Last edited by alf55; 11-13-2012 at 04:21 AM. Reason: Added comment about Csh Programming Considered Harmful