Tuesday, 13 August 2013

How to save STDERR and STDOUT of a pipeline on a file?

How to save STDERR and STDOUT of a pipeline on a file?

I'm running a pipeline of commands that have STDERR and STDOUT outputs. I
want to save both outputs in a single log file.
This are my attempts to do it:
bash my_script.sh > log.txt #Only save STDOUT
bash my_script.sh > >(tee log.txt) 2> >(tee log.txt >&2) #The STDERR
overwrite the STDOUT
I hope you can provide a simple solution to do this. Thanks for your time!

No comments:

Post a Comment