I can run my python scripts on the terminal and get the print results on the stdout e.g.
python myprog.py
or simply redirect it to a file:
python myprog.py > out.txt
My question is how could I do both solutions at the same time. My linux experience will tell me something like:
python myprog.py |& tee out.txt
This is not having the behaviour I expected, print on the fly and not all at once when the program ends.
So what I wanted (preferred without changing python code) is the same behavior as python myprog.py
(print on the fly) but also redirecting output to a file.
What is the simplest way to accomplish this?