2

Normally in a Linux command you can specify another one to be run at the same time like this:

ls | grep "sys" 

for example. In my case I have this command:

urlsnarf -i wlan0

and I can edit it like this to show filtered output:

urlsnarf -i wlan0 | cut -d\" -f4

but I also want to save the output to file and at the same time print text in the console so I edit it like this:

urlsnarf -i wlan0 | cut -d\" -f4 | tee output

but there is neither an output file nor printed output. Is there any way to fix this?

4

1 回答 1

0

我想这里发生的是管道正在被缓冲。我以前没见过urlsnarf,但它看起来像是一个持续监控的过程。根据以下帖子,您不能轻易阻止管道完全缓冲:

如何使任何 shell 命令的输出无缓冲?

从答案链接的文章很好读:在标准流中缓冲

于 2013-07-05T11:42:06.377 回答