Bash 将输出重定向到两个未命名的管道Linux

Bash 将输出重定向到两个未命名的管道Linux,bash,Bash,我希望在bash脚本中执行此操作: tail -n0 -F /var/log/kern.log > $pipe1 AND $pipe2 其中,$pipe是两个未命名的管道。我知道可以使用tee命令来完成,但我无法让它工作。这应该可以: tail -n0 -F /var/log/kern.log | tee "$pipe1" "$pipe2" >/dev/null tee输出被重定向到/dev/null,并且被阻止在终端上打印。您可以尝试:tail-n0-F/var/log/ker

我希望在bash脚本中执行此操作:

tail -n0 -F /var/log/kern.log > $pipe1 AND $pipe2
其中,
$pipe
是两个未命名的管道。我知道可以使用
tee
命令来完成,但我无法让它工作。

这应该可以:

tail -n0 -F /var/log/kern.log | tee "$pipe1" "$pipe2" >/dev/null

tee
输出被重定向到
/dev/null
,并且被阻止在终端上打印。

您可以尝试:
tail-n0-F/var/log/kern.log | tee>($pipe1)>($pipe2)
@AvihooMamka我认为这实际上会将输出分成三种方式:pipe1、pipe2和stdout(tee总是传递到stdout)。因此,该行可能应该读取
tail-n0-F/var/log/kern.log | tee>($pipe1)
($pipe2)
(tee只获取一个参数,stdout被重定向到pipe2)。在终端
tail-n0-F/var/log/kern.log | tee>($pipe1)>($pipe2)
将其重定向到自身。而
tail-n0-F/var/log/kern.log | tee>($pipe1)>>($pipe2)
根本不起作用。在脚本中,我获得了
权限被拒绝
?替代方法-由于
/var/log/kern.log
是由syslog生成的,您是否能够重新配置syslog以生成额外的输出文件?您不能简单地使用
tail…|tee“$pipe1”$pipe2”
是否没有所有重定向内容
tee
接受多个文件作为输出。