Re: sql scripts
От | Joseph Shraibman |
---|---|
Тема | Re: sql scripts |
Дата | |
Msg-id | 3C4E2A3B.10600@selectacast.net обсуждение исходный текст |
Ответ на | sql scripts (Joseph Shraibman <jks@selectacast.net>) |
Список | pgsql-general |
When bash interprets the magic line starting with #! it appends the filename to the end of the command, it doesn't pipe the contents of the file to stdin. So when I was trying to write the shells script first I tried something like #!/usr/local/bin/psql -U someuser -d dbname -f but psql couldn't handle the magic line itself, and you can't have pipes in the magic line, so I finally settled on using tail on the script itself (inspired by the jdk installers from sun). Alvaro Herrera wrote: > El jue, 20-12-2001 a las 16:48, David Link escribió: > >>Joseph Shraibman wrote: >> >>>FYI anyone who wants to have a psql shell script: >>> >>>#!/bin/bash >>>tail +4 $0 | /usr/local/pgsql/bin/psql -U postgres -d playpen >>>exit >>> >>>select version(); >>> >>Very cool. And very clever. Thanks. >> > > It should be possible to do things like > > #!/usr/local/bin/psql -U someuser -d dbname > select version(); > > > But the current psql implementation doesn't allow that for various > reasons. I don't know if it can be "fixed"... > > -- Joseph Shraibman jks@selectacast.net Increase signal to noise ratio. http://xis.xtenit.com
В списке pgsql-general по дате отправления: