Transferred from: http://blog.sina.com.cn/s/blog_605f5b4f0101azuc.html
The method for creating a named pipe is: Mkfifo pipe_name.
This allows you to create a named pipe pipe_name.
Run the command and redirect the output to the pipeline and throw the background (otherwise hang):cmd > Pipe_name &
Read pipeline content: Cat < Pipe_name can read the contents of the pipeline.
tmp_fifofile="/tmp/$$.fifo"mkfifo $tmp _fifofile 6< > $tmp _fifofile
# FD6 is pointed to the FIFO type, and if this is not the case, when writing data to the file $tmp_fifofile or & 6, theprogram will be blocked until read reads the location of the data in the pipeline.
After performing the above, the data can be written to the FIFO type file continuously during the program's operation without blocking, and the data will be saved for reading by the Read program. for ((i=0;i< $thread; i++)); Do >&6 # In fact, I put $thread a carriage return in the FD6.
Shell--mkfifo Pipe