On Fri, Mar 02, 2007 at 05:26:03PM +0100, Vincenzo Romano wrote:
> > psql gets an EOF on the named pipe when the first shell command
> > exits. You need to batch all your commands and send them in one shell
> > command, so it keeps the pipe open until it's done.
> >
> > -Doug
>
> Using "echo -n" instead of the plain "echo" to avoid sending the EOL makes the
> psql client behaving the same way: quitting after the first complete command.
> This makes useless the input redirection from anything other than a file.
No, it's exactly as he said: the FIFO only works once. As soon as
you've piped something into it and the echo closes the pipe, it closes
for psql also. As far as it's concerned you've quit, so it exits.
Replace the psql commmand with "cat" and you'll see exactly the same
effect.
I don't think you can acheive the effect you want with a FIFO. Maybe a
UDP socket will work as it doesn't require a permanent connection.
Hope this helps,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.