I am trying to run from a shell script a C++ program that print some outputs (using std::cout), and I would like to see them in the console while the program is running.
I tried some things like this :
RES=`./program`
RES=$(./program)
But all I can do is to only display the result at the end : echo $RES...
How to display the outputs in run-time in the console, AND in the variable RES ?
man tee, andman tty. Then you can split the output stream so it is reproduced to the actual terminal.