| From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
|---|---|
| To: | Andrew Pennebaker <andrew(dot)pennebaker(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Petition: Treat #!... shebangs as comments |
| Date: | 2014-07-18 15:32:53 |
| Message-ID: | 53C93E25.70105@aklaver.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 07/18/2014 08:16 AM, Andrew Pennebaker wrote:
> Could we please have the PostgreSQL lexer treat #!... on the first line
> of a file as a comment? This would enable .psql scripts to be run with
> dot-slash notation preferred by many unix users:
>
> ./script.psql
>
> While still allowing the traditional (and Windows compatible) style:
>
> psql -f script.psql
Would not doing the below accomplish the same thing for you?
http://www.postgresql.org/docs/9.3/interactive/app-psql.html
"Because of these legacy behaviors, putting more than one command in the
-c string often has unexpected results. It's better to feed multiple
commands to psql's standard input, either using echo as illustrated
above, or via a shell here-document, for example:
psql <<EOF
\x
SELECT * FROM foo;
EOF
"
So:
#!/bin/sh
psql -d production -U aklaver <<EOF
\x
SELECT * FROM plant1;
EOF
>
> --
> Cheers,
>
> Andrew Pennebaker
> www.yellosoft.us <http://www.yellosoft.us>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | John Cochran | 2014-07-18 15:49:17 | Re: Petition: Treat #!... shebangs as comments |
| Previous Message | Dennis Jenkins | 2014-07-18 15:31:40 | Re: Petition: Treat #!... shebangs as comments |