Home > other >  The problem of the pipe
The problem of the pipe

Time:09-19

 cat pipe. Sh 
#!/bin/bash
Fifo_file=fifo. Pipe
Mkfifo $fifo_file
The exec 6 & lt;> $fifo_file
The rm $fifo_file

DateWrite ()
{
I=0
While [$I lt - 1000]
Do
STR=` date `
I=$((I + 1))
Echo "$I $STR
"The done
}

For ((I=0; i<100; I++))
Do
(DateWrite & gt; & 6) & amp;
The done

While the read date_time
Do
Echo $date_time & gt;> The output. The file
Done & lt; & 6


Two questions,
1, why the rm $fifo_file, delete the file after, does not affect the operation?
2, how to modify, make this exit program can properly?
  • Related