preventing FIFO from EOF

rihad rihad at mail.ru
Fri Dec 12 05:47:20 PST 2008


Danny Braniss wrote:
>> $ mkfifo /var/tmp/foo
>> $ buffer -i /var/tmp/foo                    # misc/buffer
>> # in another console:
>> $ echo hi > /var/tmp/foo
>>
>> buffer prints hi and exits. I want it to keep reading and printing 
>> indefinitely.
>>
>> Further experimentation revealed that I need two writers: one dummy 
>> writer that just keeps /var/tmp/foo open for writing, and the other 
>> doing the "real work". This way buffer wouldn't exit. But how to emulate 
>> the dummy writer? It itself needs to block on something to keep 
>> /var/tmp/foo open. Any clean way to do this in shell? Maybe the solution 
>> is quite simple but isn't at the tip of my tongue.
>>
>> Thanks.
> 
> too easy
> n csh:
> 	while 1
> 		buffer -i /var/tmp/foo 
> 	end
> or in sh:
> 	while true; do
> 		buffer -i /var/tmp/foo
> 	done
> 

> Thanks, but I should have said that buffer must always run to never miss any data. 

The reason being that buffer's output gets fed into another program that 
shouldn't be restarted.


More information about the freebsd-hackers mailing list