Thus, if you want the behaviour you described in the above command, you could do the following:
command parms 2>&1 | cat >file.tmp which would put everything in the file file.tmp Erik Johnson On Thu, Jan 8, 2009 at 1:30 PM, Edmund R. MacKenty <ed.macke...@rocketsoftware.com> wrote: > On Thursday 08 January 2009 14:13, John McKown wrote: >>Well, shoot. That never even occurred to me. What I thought that would do >>was: >> >>Change stderr to go where stdout currently goes, then change stdout to go >>into the pipe. I based this on the fact that if I do: >> >>command 2>&1 1>x.tmp >> >>Then stderr still comes to my terminal. It does not go to x.tmp. I guess >>there is some special code in bash to recognize the redirection & piping >>as "special". > > Actually, there's no special case for this. The rule is that the shell > processes I/O redirections left-to-right. The "2>&1" syntax just means" make > file descriptor 2 (stderr) refer to whatever file descriptor 1 (stdout) > refers to. It doesn't change stdout at all. File descriptor 1 already > refers to the pipe because the shell creates the pipes as it is parsing the > pipeline, before it parses the simple commands within the pipeline. > > I hope that makes sense! :-) > - MacK. > ----- > Edmund R. MacKenty > Software Architect > Rocket Software > 275 Grove Street · Newton, MA 02466-2272 · USA > Tel: +1.617.614.4321 > Email: m...@rs.com > Web: www.rocketsoftware.com > > ---------------------------------------------------------------------- > For LINUX-390 subscribe / signoff / archive access instructions, > send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit > http://www.marist.edu/htbin/wlvindex?LINUX-390 > ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390