tee
- Command# Command
[command] | tee [output_filename]
# Example
cat file.txt | tee out.log
# Command
[command] | tee -a [output_filename]
# Example
cat file.txt | tee -a out.log
stdout
and stderr
Separately# Command
[command] > >(tee [stdout_filename]) 2> >(tee [stderr_filename] >&2)
# Example
./run_inference_demo.sh > >(tee stdout.log) 2> >(tee stderr.log >&2)
stdout
and stderr
into the Same File# Command 1
[command] 2>&1 | tee [out_filename]
# Example 1
./run_inference_demo.sh 2>&1 | tee out.log
# Command 2
[command] |& tee [out_filename]
# Example 2
./run_inference_demo.sh |& tee out.log