It should be noted that 2> & 1 means that the standard error will also be redirected along with the standard output. So
someCommand | tee someFile
gives you standard output in a file, but not a standard error: a standard error appears only in the console. To get the standard error in the file, you can use
someCommand 2>&1 | tee someFile
(source: In the shell, what is "2> & 1", ). Finally, both of the above commands will trim the file and begin cleaning. If you use a sequence of commands, you may want to get the output and the error of all of them one by one. In this case, you can use the -a flag for the "tee" command:
someCommand 2>&1 | tee -a someFile
Serge Rogatch Nov 05 '14 at 12:21 2014-11-05 12:21
source share