[shell question]

Matt Graham danceswithcrows@usa.net
30 Jul 2001 13:47:16 EDT


"Matthew Ryan Fuerst" <fuerstma@pilot.msu.edu> wrote:
> Silly shell question -
> 
> Is there a way to log the output of a command into a file as well as to 
> the terminal?
> 
> I am planning on building apache from source, and want to capture the 
> output to afile for future reference, but would also like to see it on 
> the screen..
> 
> I thought of something silly like
> ./configure >> apache.output >> echo
> but I don't know if that will do the trick....

No, it won't.  I think you're looking for the "tee" command.  Like so:

./configure | tee apache.output

will send STDOUT to both the screen and the file "apache.output".  tee can
take multiple output files.  If you want the output file to contain both
STDERR and STDOUT, do it like so:

./configure 2>&1 | tee apache.output

(assuming you're using bash, the syntax is different for tcsh.)


-- 
Matt G / Dances With Crows
There is no Darkness in Eternity/But only Light too dim for us to see
"I backed up my brain to tape, but tar says the tape contains no data...."