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

前端 未结 6 984
孤街浪徒
孤街浪徒 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:07

    The unbuffer command from the expect package does exactly what you are looking for.

    $ sudo apt-get install expect
    $ unbuffer python program.py | cat -
    
    

提交回复
热议问题