[RndTbl] another shell thing I've forgotten...
Adam Thompson
athompso at athompso.net
Sat Jul 31 18:18:47 CDT 2010
Inside a shell script, I want to start a persistent mysql client process and feed it commands one by one.
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.
If I use a named pipe, every time I echo something to that pipe (e.g. “echo INSERT INTO… > /tmp/mypipe”), mysql immediately exits upon reaching EOF, so only the very first command gets executed.
I recall posting a way to accomplish this with psql & inetd a year or two ago, but I don’t want to use inetd – this *must* 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.
Anyone have any better ideas?
Thanks,
-Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.muug.mb.ca/pipermail/roundtable/attachments/20100731/c832a71b/attachment.html
More information about the Roundtable
mailing list