I/O Redirection with the C Shell

Reid Spencer reid at unitek.UUCP
Wed Dec 4 05:45:23 AEST 1985


[Sigh]

Recently (last week), I posted an inquiry for information on how
to separate the standard error from the standard output using the
C Shell. 

I have received several messages and there seems to be two solutions -
one of which is more popular than the other. I thank all those who
took the time to respond.

My problem was:

   How do you redirect the standard error of a job to a different 
   place than the standard output.  For example, using Bourne Shell,
   we would do the following:
      
       nroff -ms document >doc 2>index


In the C Shell, the solution seems to be:

   Use brackets to run the job in a sub-shell and redirect the I/O
   at two different levels: (this is the popular one)

      (nroff -ms document >doc) >& index

Or, using the Bourne Shell:

	  sh -c 'nroff -ms document >doc 2>index'


Both versions work quite well - I haven't decided which I like better
yet, but I am grateful for all the responses.  Thanks again.


Reid Spencer  ...!ubc-vision!unitek!reid



More information about the Comp.unix mailing list