[net.unix-wizards] separate redirection of stdout and stderr in C-shell

v.wales@UCLA-Security@sri-unix (06/16/82)

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

jce (06/16/82)

(if I knew how to get this thru arpanet directly to v.wales, i wouldn't
post it here.)
I agree - cshell should allow redirection of ANY file descriptor.
John Eldridge	harpo!floyd!jce

davidson (06/19/82)

I also think that the next step for csh is to allow
pipefitting on programs which have an arbitrary number
of input and output streams.  For example, editors have
two input streams; the file to be edited and your keyboard
or editing script, and two output files, the result of
the edit and the display of the editing process.  It
should be possible to pipefit these streams with other
tools in an arbitrary fashion by name.

I would be interested in hearing people's ideas on how
this should work.

Greg Davidson (davidson@nprdc)

greep@RAND-UNIX@sri-unix (08/06/82)

Date: Monday, 19 Jul 1982 10:19-PDT
Re your example: the file to be edited is a stream?  I don't think
I would want to use an interactive editor  that required me to make
a single pass through the file without backing up.