Shell--mkfifo Pipe

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.