doing this in bash script
./Execute_program > MyOutput
I get a log file from the output, however this causes the output not to be displayed on the terminal screen. Is there any way to do the same but at the same time the output can be displayed on the screen?
Asked
Active
Viewed 996 times
1

Jose Esteban
- 13
1 Answers
2
Use the universal pipe fitting, tee
. tee
reads input, and duplicates the output to both standard output and the specified file:
./Execute_program | tee MyOutput
If you want to append to rather than overwrite the specified file, use -a
:
./Execute_program | tee -a MyOutput
If you want to write to several files, just add them as additional parameters:
./Execute_program | tee MyOutput MyOtherSavedLog

DopeGhoti
- 76,081
program | tee myoutput
– thrig Feb 06 '17 at 23:12