I've seen things like
command > out.txt
Sometimes appended with
2&1
But these seem to divert all output or all error streams instead of both displaying and copying the output into the file, which is what I'm trying to do. Do I have any options?
I've seen things like
command > out.txt
Sometimes appended with
2&1
But these seem to divert all output or all error streams instead of both displaying and copying the output into the file, which is what I'm trying to do. Do I have any options?
If you can have stdout and stderr into the file
command 2>&1 | tee -a log
Else you swap stdout and stderr using 3
{ command | tee stdout.log; } 3>&1 1>&2 2>&3 | tee stderr.log