There&#39;s discussion of it at <a href="http://www.linuxjournal.com/article/2156">http://www.linuxjournal.com/article/2156</a>, including a work around:<div><br></div><div>sleep 9999999 &gt; pipe &amp;</div><div><br></div>
<div>You could probably come up with something more clever than that, but the general idea seems to be that the pipe closes when all the writers are done, this keeps it open. I&#39;d imagine a simple C program to fork off, open the file, and then while(1) { sleep(99999);} would be good enough.</div>
<div><br></div><div>Sean<br><br><div class="gmail_quote">On Sat, Jul 31, 2010 at 6:18 PM, Adam Thompson <span dir="ltr">&lt;<a href="mailto:athompso@athompso.net">athompso@athompso.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-CA" link="blue" vlink="purple"><div><p class="MsoNormal">Inside a shell script, I want to start a persistent mysql client process and feed it commands one by one.</p><p class="MsoNormal">I’d like to use a named pipe, but the only way I’ve found to do it so far is with a subshell, by putting 99% of the script inside the subshell and piping the subsell’s entire output to mysql.  While this more-or-less works, it’s very much not ideal.</p>
<p class="MsoNormal">If I use a named pipe, every time I echo something to that pipe (e.g. “echo INSERT INTO… &gt; /tmp/mypipe”), mysql immediately exits upon reaching EOF, so only the very first command gets executed.</p>
<p class="MsoNormal">I recall posting a way to accomplish this with psql &amp; inetd a year or two ago, but I don’t want to use inetd – this *<b>must</b>* be entirely self-contained within a single shell script.  Also I can’t figure out a way to tell mysql to ignore EOF on STDIN and to immediately reopen it.</p>
<p class="MsoNormal"> </p><p class="MsoNormal">Anyone have any better ideas?</p><p class="MsoNormal"> </p><p class="MsoNormal">Thanks,</p><p class="MsoNormal">-Adam</p><font color="#888888"><p class="MsoNormal"> </p></font></div>
</div><br>_______________________________________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.mb.ca">Roundtable@muug.mb.ca</a><br>
<a href="http://www.muug.mb.ca/mailman/listinfo/roundtable" target="_blank">http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Sean Walberg &lt;<a href="mailto:sean@ertw.com">sean@ertw.com</a>&gt;    <a href="http://ertw.com/">http://ertw.com/</a><br>
</div>