Click to See Complete Forum and Search --> : [SOLVED]How to create a log File using tee??


rmvinodh123
04-12-2007, 03:03 AM
I want the o/p of a program to be displayed on the terminal as well as in a file.
Tee command does this but, if an error occurs in the program it is only displayed on the terminal and not in the file.How to make tee read from stderr as well or is there any other way to do this.

Please help.

cybertron
04-12-2007, 03:36 PM
Most likely you need to add 2>&1 to the end of your command before you pipe it to tee. It should look like this: "command option1 option2 2>&1 | tee".

That should send stderr to stdout, which is what tee reads from, so errors will show up in both places.

rmvinodh123
04-15-2007, 11:07 PM
Yes it worked

i tried this : cmd 2>&1 | tee file

Tnx.

cybertron
04-15-2007, 11:34 PM
Glad it helped.:)