Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!nucsrl!tellab5!laidbak!ism.isc.com!bud.sos.ivy.isc.com!willcr From: willcr@bud.sos.ivy.isc.com (Will Crowder) Newsgroups: comp.unix.wizards Subject: Re: How does one redirect just stderr under the C Shell? Message-ID: <1991May09.001313.23696@ism.isc.com> Date: 9 May 91 00:13:13 GMT References: <2740@umriscc.isc.umr.edu> <1991May08.154738.26889@convex.com> Sender: usenet@ism.isc.com (Ism Usenet News) Reply-To: willcr@ivy.isc.com Followup-To: comp.unix.wizards Organization: Interactive Systems Corp. Lines: 57 In article <1991May08.154738.26889@convex.com>, tchrist@convex.COM (Tom Christiansen) writes: > From the keyboard of rwl@ee.umr.edu (Wayne Little): > > [How do I redirect stderr independent of stdout under C Shell?] > > In general, it can't be done. > > Now, I'm sure someone will suggest > > ( foo > foo.stdout ) >& foo.stderr > > but that's not right: stdout is mangled. How is stdout mangled? Is it because "isatty(fileno(stdout))" will no longer be true? > Someone else > will suggest > > ( foo > /dev/tty ) >& foo.stderr > > but that's not right, as stdout is no longer going where it > had been going. Now this, at least, I see. If the above were part of a pipeline in which stdout had already been redirected, things would go awry quite quickly, as well as in a number of other scenarios as well, I'm sure. Redirector emptor! :) :) :) |> If your system should support /dev/fd pseudo-devices, this |> ought to work: |> |> ( foo > /dev/stdout ) >& foo.stderr |> |> But few of us have that feature on our systems. I sure wish my system (Sun) did! That sounds like the right general solution to me. Actually, I suggested both of the above in e-mail, with the disclaimer "I'm no wizard." Glad I put that disclaimer on there...although I did get mail back from Wayne saying it worked fine for his particular case. |> -- |> Tom Christiansen tchrist@convex.com convex!tchrist |> "So much mail, so little time." ^^^^^^^^^^^ That's why I posted this... Will -------------------------------------------------------------------------------- Will Crowder, MTS | "I was gratified to be able to answer quickly, (willcr@ivy.isc.com) | and I did: I said I didn't know." INTERACTIVE Systems Corp. | -- Mark Twain