如何使用timeout命令在文件中获取日志?(How to get logs in a file when using the the timeout command?)
我试图将我下面的命令的日志抓到如下的文本文件:
timeout 10 glxheads &> test.txt但不幸的是,我没有通过这种方法将任何日志传输到文本文件。
事实上,在超时时间内完成的任何简单命令都不会将输出发送到文件。
注意:下面的命令有效,
glxheads &> test.txt任何人都可以提出任何想法来解决这个问题?
谢谢 !
I am trying to grab the logs of my below command to a text file like below:
timeout 10 glxheads &> test.txtBut unfortunately, I am not not getting any logs transferred to the text file by this approach.
Infact any simple command done under timeout doesnt give out the output to a file.
Note: The below command works,
glxheads &> test.txtCould anyone suggest any ideas to get around this issue?
Thanks !
最满意答案
根据Dmitri指定的链接,我可以通过执行以下操作来解决此问题:
stdbuf -oL -eL timeout 10 glxheads &> test.txt或使用
unbuffer timeout 10 glxheads &> test.txtAs per the link specified by Dmitri, I was able to resolve this issue by doing the following:
stdbuf -oL -eL timeout 10 glxheads &> test.txtor using
unbuffer timeout 10 glxheads &> test.txt更多推荐
发布评论