如何pipe道和回应正在处理的结果?

我想执行这个命令:

find /apps/ -type f -print0 | grep -z log$ | xargs -0 grep 'this->aForm' 

并行,我想看看哪些文件正在处理。

如何对此?

有一个类似的问题EN堆栈溢出:

https://stackoverflow.com/questions/670784/redirecting-bash-stdout-stderr-to-two-places

这个想法是使用命名pipe道,在bash中你可以简单地做:

command_that_writes_to_stdout | tee >(command_that_reads_from_stdin)

但在一般情况下,使用mkfifo ,例如:

 mkfifo some_pipe command_that_writes_to_stdout | tee some_pipe \ & command_that_reads_from_stdin < some_pipe rm some_pipe 

(这两个例子都来自Stack Overflow的答案)