[comp.unix.questions] easy question: how to redirect stdin and stderr in sh?

jmc@inesc.UUCP (Miguel Casteleiro) (09/23/90)

The subject says it all!  I want to redirect to a file in shell
(/bin/sh) the stdin and stderr of a process.
So, how do I do it?

Thanks!

-- 
                                                                      __
 Miguel Casteleiro at                                            __  ///
 INESC, Lisboa, Portugal.        "News: so many articles,        \\\/// Only
 UUCP: ...!mcsun!inesc!jmc        so little time..."              \XX/ Amiga

subbarao@phoenix.Princeton.EDU (Kartik Subbarao) (09/23/90)

In article <750@inesc.UUCP> jmc@inesc.UUCP (Miguel Casteleiro) writes:
>The subject says it all!  I want to redirect to a file in shell
>(/bin/sh) the stdin and stderr of a process.
>So, how do I do it?

Arrgh! This was covered just a few days ago -- even then, its in the
Frequently Asked Questions list which should be consulted before posting!
Even better, the bourne (/bin/sh) man pages!

use process > stdoutfile to redirect only stdout
    process 2> stderrfile to redirect only stderr
    process > stdoutfile 2> stderrfile to redirect both separately
    process > stdoutanderrfile 2>&1 to redirect both together

                                                               __  ///
 Maybe you should spend some more>"News: so many articles,     \\\/// Only
                           time!>  so little time..."           \XX/ Amiga

								^^^^^^^^^^^^^
							I guess if you restrict
							yourself to such toys,
							you can't learn much
							else. ;-)


			-Kartik




(I need a new .signature -- any suggestions?)
subbarao@{phoenix or gauguin}.Princeton.EDU -|Internet
kartik@silvertone.Princeton.EDU (NeXT mail)       -|	
subbarao@pucc.Princeton.EDU		          - Bitnet

cpcahil@virtech.uucp (Conor P. Cahill) (09/23/90)

In article <750@inesc.UUCP> jmc@inesc.UUCP (Miguel Casteleiro) writes:
>The subject says it all!  I want to redirect to a file in shell
>(/bin/sh) the stdin and stderr of a process.
>So, how do I do it?

RTFM.  sh(1) man page, especially the part that discusses >, 2>, etc.



-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170