[comp.unix.questions] Redirecting stdout stderr separately.

abc@unh.UUCP (Avinash B Chopde) (03/31/88)

Is there any simple way in C-Shell to duplicate the following
Bourne Shell command to redirect stdout messages to file1 and
stderr messages to  file 2 ?

$ command 1> file1 2> file2

Right now, I enter the Bourne shell from C-Shell every time I need
to do stuff like that.

Thanks in advance for any replies.

-- 
Avinash Chopde
     abc@unhcs.CSNET              {.....}!uunet!unh!abc
"You're Joking Me!"
====================         (Standard Disclaimer Applies).

karish@denali.UUCP (karish) (03/31/88)

In article <287@unh.UUCP> abc@unh.UUCP (Avinash B Chopde) writes:
>
>Is there any simple way in C-Shell to duplicate the following
>Bourne Shell command to redirect stdout messages to file1 and
>stderr messages to  file 2 ?
>
>$ command 1> file1 2> file2

% (command > file1) >& file2

>Avinash Chopde

Chuck

sue@encore.UUCP (Sue LoVerso) (03/31/88)

In article <287@unh.UUCP> abc@unh.UUCP (Avinash B Chopde) writes:
>
>Is there any simple way in C-Shell to duplicate the following
>Bourne Shell command to redirect stdout messages to file1 and
>stderr messages to  file 2 ?
>
>$ command 1> file1 2> file2
>
The simplest way I know of is:

% (command > file1) >& file2

Execute the command in a subshell, redirecting its output to file1,
and then its stderr output can be redirected at shell level to file2.

-- 
Susan J. LoVerso		Encore Computer Corp.
sue@multimax.arpa		
encore!sue

rsalz@bbn.com (Rich Salz) (04/01/88)

In comp.unix.questions (<287@unh.UUCP>), abc@unh.UUCP (Avinash B Chopde) asks
for the csh equivalent of the following /bin/sh fragment:
	$ command 1> file1 2> file2

Gotta use an extra sub-shell:
	% (command >file1) >& file2
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.

rns@se-sd.sandiego.NCR.COM (Rick Schubert) (04/01/88)

In article <287@unh.UUCP> abc@unh.UUCP (Avinash B Chopde) writes:
>
>Is there any simple way in C-Shell to duplicate the following
>Bourne Shell command to redirect stdout messages to file1 and
>stderr messages to  file 2 ?
>
>$ command 1> file1 2> file2

Try this:

% (command > file1) >& file2

This (I believe) causes an extra shell to be executed, so it is less
efficient than for the Bourne shell, but it should do what you want.