Stupid shell I/O redirection question...

dan at rna.UUCP dan at rna.UUCP
Tue Feb 24 14:10:45 AEST 1987


> 	I have a shell script which issues commands that generate output on
> both the stdout and stderr (1 and 2). I want to redirect both stdout and stderr

	To partially answer my own question, upon further experimentation, it
does appear that

	cmd 2>&1 | tee log

does do what I wanted. I was trying,

	time date 2>&1 | tee log

which doesn't work. But I think that is because "time" is built into the Korn
shell that I am using. Only

	(time date 2>&1) | tee log

works, although

	/bin/time date 2>&1 | tee log

also works.

	Which brings up the even more stupid question of how do you control
when the dup() occurs. Suppose you DID want the stderr to be the OLD stdout
and the NEW stdout to be the pipe. (why, well...)



More information about the Comp.unix.questions mailing list