Bash 如何在不使用文件的情况下拆分/复制FIFO
我希望拆分FIFO,以便能够在不丢失原始内容的情况下分析副本:Bash 如何在不使用文件的情况下拆分/复制FIFO,bash,Bash,我希望拆分FIFO,以便能够在不丢失原始内容的情况下分析副本: cat < outfile | tee > outfile2 | tee > outfile3 & declare DONE= until [ $DONE ]; do IFS= read -r -d '}' line || DONE=1 { [ "${line: -12}" == '{ready123450' ] || [ "${line: -13}"
cat < outfile | tee > outfile2 | tee > outfile3 &
declare DONE=
until [ $DONE ]; do
IFS= read -r -d '}' line || DONE=1
{ [ "${line: -12}" == '{ready123450' ] || [ "${line: -13}" == '{ready_123450' ]; } && {
DONE=1
echo "> $line"
}
done < <( cat < outfile2 & )
catoutile2 | tee>outile3&
宣告完成=
直至[$完成];做
如果s=read-r-d'}'行| | DONE=1
{[“${line:-12}”='{ready123450']| |[“${line:-13}”=='{ready_123450']}&&{
完成=1
echo“>$line”
}
完成<该代码…制造了许多无用的东西。cat
的无用使用:cat您的第一条管道在outfile3
上不工作,它将保持为空file@KamilCuk1)这是不正确的:outfile*
是FIFO,如果我在FIFO名称前省略
outfile2
不起作用:tee>outfile2>outfile3
但是outfile3 FIFO仍然没有输出任何东西。2)你是对的,我可以省略&
。我使用Bash v3.2。@Inian为什么这个FIFO保持为空?这是我的问题。删除
。。。。不tee>outfile2>outfile3
Dotee-outfile2-outfile3
。请研究tee
在shell中做什么以及重定向操作符做什么。为什么这个FIFO保持为空?
因为您正在将输出重定向到outfile2
,所以下一个命令将不接收任何内容。Ru没有参数的nningtee
是无用的。
cat < outfile3