From: utzoo!decvax!cca!v.wales@UCLA-Security@sri-unix Newsgroups: net.unix-wizards Title: separate redirection of stdout and stderr in C-shell Article-I.D.: sri-unix.1762 Posted: Wed Jun 16 03:24:23 1982 Received: Fri Jun 18 04:39:57 1982 From: v.wales at UCLA-Security (Rich Wales) Date: 3 June 1982 1920-PDT (Thursday) I'm sure most C-shell users have discovered to their dismay that there is no direct way to redirect the error output separately from the standard output. That is, the following Bourne-shell construct -- mycommand > outputfile 2> errorfile -- doesn't have a direct equivalent in the C shell. The closest the C shell claims to provide you with is the following -- mycommand >& outputfile -- which redirects BOTH STREAMS TOGETHER into a single file. I was on the verge of planning surgery on the C shell to correct this defect when I stumbled upon the following kludge: ( mycommand > outputfile ) >& errorfile As far as I can tell, this appears to do the job fine -- albeit at the expense of an additional subshell that wasn't there before. It still would be nice, though, if the C shell provided the same functionality for redirecting input and output streams separately by file-descriptor number as the Bourne shell. This is one of the few areas (maybe the only one) where /bin/sh wins over /bin/csh. Does anyone else out there agree with me that this would be a good addition to the C shell? Has anyone already done it? What would be a good syntax -- something that would fit nicely into the existing C-shell notational conventions? If Berkeley isn't willing to change the C shell in this direction, at least maybe the above kludge (or something better, if there is one) could find its way into the manual page. -- Rich