on-the-fly output redirection, seeing the file redirection output while the program is still running

前端 未结 6 827
孤街浪徒
孤街浪徒 2021-02-08 01:36

If I use a command like this one:
./program >> a.txt &
, and the program is a long running one then I can only see the output once the program ended. That means I ha

6条回答
  •  再見小時候
    2021-02-08 02:19

    Have you considered piping to tee?

    ./program | tee a.txt
    

    However, even tee won't work if "program" doesn't write anything to stdout until it is done. So, the effectiveness depends a lot on how your program behaves.

提交回复
热议问题