开发者

Tee a Pipe Asynchronously

开发者 https://www.devze.com 2022-12-29 21:05 出处:网络
I would like to write the same information to two pipes, but I don\'t want to wait for the first pipe to read.Here\'s an example

I would like to write the same information to two pipes, but I don't want to wait for the first pipe to read. Here's an example

mkfifo one
mkfifo two
echo hi | tee one two &
cat one &
cat two &

cat one does not start reading until cat two is run. Is there a way to make cat one run without wa开发者_运维百科iting?


Problem: Fifos are blocking until opened for reading. So just open a read FD on them:

mkfifo one two
echo hi | tee one two &
exec 3<one
exec 4<two
cat <&3
cat <&4


echo hi | tee one | tee two &
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号