Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!shlump.nac.dec.com!fyrpwr.enet.dec.com From: prakash@fyrpwr.enet.dec.com (Mayank Prakash) Newsgroups: comp.unix.shell Subject: Re: I/O Redirection question Message-ID: <22107@shlump.nac.dec.com> Date: 17 Apr 91 14:26:34 GMT References: <1991Apr11.144844.28800@riacs.edu> Sender: newsdaemon@shlump.nac.dec.com Reply-To: prakash@aiag.enet.dec.com Followup-To: comp.unix.shell Organization: Digital Equipment Corporation, Marlboro, MA. Lines: 44 In article , browning@nas.nasa.gov (David S. Browning) writes: |->In article <1991Apr11.144844.28800@riacs.edu> dwsmith@loki.arc.NASA.GOV (David Smith) writes: |-> |-> I have a question regarding I/O redirection. I have a program in which |-> writes to stdout and stderr. I have redirected both of these to a file. |-> |-> Now comes the problem. I need to capture stdout in a file along with |-> stderr, but I also need stdout to go to the terminal for prompting of |-> input. Is this possible? If so, how does one do this? |-> |->I have a related question. Is it possible, in csh, to redirect stdout |->and stderr to different files? Or to redirect stderr and not stdout? |->I know how to do it in sh/ksh, but not in csh. |-> |->Thanks, |->David |-> -- In csh, try the following - (cmd > outfile) >& errfile to send stdout of cmd to outfile, and stderr to errfile. To redirect stderr, and not stdout, is a bit harder. If stdout is the terminal, the following would work - (cmd | tee /dev/tty > /dev/null) >& errfile It should give you ideas of how to do it in general. -mayank. +--------------------------------------------------------------------------+ | InterNet: Prakash@AIAG.ENET.DEC.COM | | UUCP: ...!decwrl!aiag.enet.dec.com!Prakash | | VoiceNet: (508)490.8139 | | BitNet: prakash%aiag.enet at decwrl.dec.com | | SnailNet: DEC, 290 Donald Lynch Blvd. DLB5-2/B4, Marlboro, MA 01752-0749 | +--------------------------------------------------------------------------+ Disclaimer: The above is probably only line noise, and does not reflect the opinions of anybody, including mine, far less my employer's.