Path: utzoo!attcan!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: Re: csh question Message-ID: <7093@star.cs.vu.nl> Date: 9 Jul 90 18:28:50 GMT References: <13132@ulysses.att.com> <59@siva.UUCP> <7267@large.cray.com> <1990Jul09.150046.4238@virtech.uucp> Sender: news@cs.vu.nl Reply-To: maart@cs.vu.nl (Maarten Litmaath) Distribution: comp.unix.questions Organization: VU Informatika, Amsterdam, The Netherlands Lines: 23 In article <1990Jul09.150046.4238@virtech.uucp>, wonus@virtech.uucp (Kevin C. Wonus) writes: )In article <7267@large.cray.com> tbc@large.cray.com (Tom Craig) writes: )>I have a csh question. Is it possible to redirect stdout and stderr to )>different files in the c shell, (like 1>out 2>err in the bourne shell)? ) )Yes: ) (program_name > output) >& error ) )'>&' operator redirects stdout and stderr. Therefore, stdout must be )redirected )first and is enclosed in () for that reason. After stdout is redirected, the )'>&' operator redirects only stderr. Right answer, wrong logic. First we create a subshell whose stdout _and_ stderr have been redirected to the file `error'. _In_ the subshell we execute `program_name' with its stdout redirected to the file `output'; we don't mess with its stderr, so that'll still be connected to `error'. The result of it all is stdout going to `output' and _only_ stderr going to `error'. QED -- "and with a sudden plop it lands on usenet. what is it? omigosh, it must[...] be a new user! quick kill it before it multiplies!" (Loren J. Miller)