Re: Petition: Treat #!... shebangs as comments - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Petition: Treat #!... shebangs as comments
Date
Msg-id 53C93E25.70105@aklaver.com
Whole thread Raw
In response to Petition: Treat #!... shebangs as comments  (Andrew Pennebaker <andrew.pennebaker@gmail.com>)
Responses Re: Petition: Treat #!... shebangs as comments  (John Cochran <j69cochran@gmail.com>)
Re: Petition: Treat #!... shebangs as comments  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
List 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.klaver@aklaver.com


pgsql-general by date:

Previous
From: Dennis Jenkins
Date:
Subject: Re: Petition: Treat #!... shebangs as comments
Next
From: John Cochran
Date:
Subject: Re: Petition: Treat #!... shebangs as comments