Redirect output of shell script to a file

Posted by Buzkie on Stack Overflow See other posts from Stack Overflow or by Buzkie
Published on 2010-03-08T18:29:48Z Indexed on 2010/03/08 18:36 UTC
Read the original article Hit count: 225

Filed under:
|

I'm trying to redirect the output of my script and it needs to be called inside the script.

filename=uname -a
filename="$filename" date

2>&1 | tee $filename".txt"

That is what I have so far, but it's obviously wrong. I don't know too much SH scripting, so help is appreciated

-Alex

© Stack Overflow or respective owner

Related posts about shell

Related posts about scripting