Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!gvlf3.gvl.unisys.com!burdvax!wrp From: wrp@PRC.Unisys.COM (William R. Pringle) Newsgroups: comp.unix.shell Subject: Re: I/O Redirection question Keywords: redirection, stdout, stderr Message-ID: <17222@burdvax.PRC.Unisys.COM> Date: 14 Apr 91 03:16:26 GMT References: <1991Apr11.144844.28800@riacs.edu> Organization: Unisys Corporation, Paoli Research Center; Paoli, PA Lines: 26 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? You can always write to the terminal with: echo "prompt message" > /dev/tty In sh (or ksh), you can redirect stderr into stdout by: echo "message" 2>&1 # send stderr to stdout echo "message" 1>&2 # send stdout to stderr You can have everything go to both the terminal and a file by: ( whatever shell commands you want 2>&1) | tee file_name Hope this helps! Bill Pringle prc.unisys.com