I'm using named pipes in a bash script and I can't figure out how
to send an EOF so that the reader can exit.
I tried the obvious:
echo -e "\004" > mypipe
I also tried "rm mypipe"
Neither seems to generate an EOF
Anyone have any other ideas?
/dan
Printable View
I'm using named pipes in a bash script and I can't figure out how
to send an EOF so that the reader can exit.
I tried the obvious:
echo -e "\004" > mypipe
I also tried "rm mypipe"
Neither seems to generate an EOF
Anyone have any other ideas?
/dan
Daniel Ganek wrote:
[color=blue]
> I'm using named pipes in a bash script and I can't figure out how
> to send an EOF so that the reader can exit.
>
> I tried the obvious:
>
> echo -e "\004" > mypipe
>
> I also tried "rm mypipe"
>
> Neither seems to generate an EOF
>
> Anyone have any other ideas?[/color]
Have the writer /close()/ the pipe
See the "I/O on Pipes and FIFOs" section of pipe(7) ("man 7 pipe")
"If all file descriptors referring to the write end of a pipe have
been closed, then an attempt to read(2) from the pipe will see
end-of-file (read(2) will return 0)."
--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
[url]http://pitcher.digitalfreehold.ca/[/url] | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
Lew Pitcher wrote:[color=blue]
> Daniel Ganek wrote:
>[color=green]
>> I'm using named pipes in a bash script and I can't figure out how
>> to send an EOF so that the reader can exit.
>>
>> I tried the obvious:
>>
>> echo -e "\004" > mypipe
>>
>> I also tried "rm mypipe"
>>
>> Neither seems to generate an EOF
>>
>> Anyone have any other ideas?[/color]
>
> Have the writer /close()/ the pipe
>
> See the "I/O on Pipes and FIFOs" section of pipe(7) ("man 7 pipe")
> "If all file descriptors referring to the write end of a pipe have
> been closed, then an attempt to read(2) from the pipe will see
> end-of-file (read(2) will return 0)."
>[/color]
OK, but how do I get bash to close a named pipe?
/dan
Lew Pitcher <lpitcher@teksavvy.com> writes:
< Daniel Ganek wrote:[color=blue]
>[color=green]
>> I'm using named pipes in a bash script and I can't figure out how
>> to send an EOF so that the reader can exit.
>>
>> I tried the obvious:
>>
>> echo -e "\004" > mypipe[/color][/color]
a stab in the dark says `echo -en "\004"' may help but doubtful. At ^Z may
work.
kill -l may help? Sighup? dunno.
Stephen Gonedes wrote:[color=blue]
> Lew Pitcher <lpitcher@teksavvy.com> writes:
>
> < Daniel Ganek wrote:[color=green][color=darkred]
>>> I'm using named pipes in a bash script and I can't figure out how
>>> to send an EOF so that the reader can exit.
>>>
>>> I tried the obvious:
>>>
>>> echo -e "\004" > mypipe[/color][/color]
>
> a stab in the dark says `echo -en "\004"' may help but doubtful. At ^Z may
> work.
>
> kill -l may help? Sighup? dunno.
>
>[/color]
Did you try looking over the "advanced bash scripting guide" available
here (free):
[url]http://tldp.org/guides.html[/url]