Using tee command for one command at once

I am new to using the team tee.

I try to run one of my programs, which takes a lot of time, but it prints information as it moves. I use "tee" to save the output to a file, and also to view the output in a shell ( bash).

But the problem teedoes not redirect the output to the shell until the end of my command. Is there any way to do this?

I use Debian and bash.

+5
source share
3 answers

, . stdout stderr . , , C- , , printf, .

tee , , . , , .

+3

, , . stdbuf, :

stdbuf - COMMAND, .

+1

, , ,

(for i in `seq 10`; do echo $i; sleep 1s; done) | tee ./tmp

Proper use of the tee command and seems to work. Replace the part in front of the pipe with your team and you should be good to go.

0
source

All Articles