I/O Redirection question
    William R. Pringle 
    wrp at PRC.Unisys.COM
       
    Sun Apr 14 13:16:26 AEST 1991
    
    
  
In article <1991Apr11.144844.28800 at riacs.edu> dwsmith at 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
    
    
More information about the Comp.unix.shell
mailing list