Named pipe behavior: Flushing pipes
Roger Oberholtzer
roger
Mon May 17 11:56:46 PDT 2004
How was this pipe made?
On Thu, 2003-12-11 at 03:38, Joel Hammer wrote:
> Using named pipes in bash:
> A book says that:
> echo My message > pipe
> will block if there is no program reading the pipe. On my system, the
> command doesn't block. You can use echo over and over to send things to
> the pipe.
> eg:
> echo line 1 > pipe
> echo line 2 > pipe
>
> If you then type this:
> cat < pipe
> This blocks, even though the pipe is full of stuff.
>
> If you echo one more thing to the pipe (in another terminal, leaving
> that blocked cat statement alone), like:
>
> echo last line
>
> everything in the pipe is printed out
>
> line 1
> line 2
> last line
>
> with that blocking cat command suddenly waking up.
>
> SO:
> How can you make the cat command read the contents of the pipe
> without having to have an additional echo command to flush the pipe?
>
>
> Joel
>
> _______________________________________________
> Linux-users mailing list
> Linux-users at smtp.linux-sxs.org
> Unsubscribe/Suspend/Etc -> http://smtp.linux-sxs.org/mailman/listinfo/linux-users
More information about the Linux-users
mailing list