From: | Francisco Olarte <folarte(at)peoplecall(dot)com> |
---|---|
To: | Andrew Pennebaker <andrew(dot)pennebaker(at)gmail(dot)com> |
Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Petition: Treat #!... shebangs as comments |
Date: | 2014-07-18 15:51:35 |
Message-ID: | CA+bJJbxqQunea6OEZj3GyaBidpyDaSk-9nKSvOj4uFDJ9PFnUQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi:
On Fri, Jul 18, 2014 at 5:16 PM, Andrew Pennebaker
<andrew(dot)pennebaker(at)gmail(dot)com> 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
Dot-slash is not a notation, it's a requisite if you do ( correctly )
not have . in your $PATH.
Anyway, this is a little bit complex, as psql many times needs arguments.
It's been pointed it can be done with a shell script. If you can live
with a little noise you can have it dual ( The \r makes it ignore the
previous lines, the \q makes it exit before reading the EOF line ):
~/tmp $ cat kk.sql
#!/bin/bash
psql service=redacted <<EOF
\r
select 2*3*7;
\q
EOF
~/tmp $ psql -f kk.sql service=redacted
Query buffer reset (cleared).
?column?
----------
42
(1 row)
~/tmp $ psql service=redacted < kk.sql
Query buffer reset (cleared).
?column?
----------
42
(1 row)
~/tmp $ ./kk.sql
Query buffer reset (cleared).
?column?
----------
42
(1 row)
Francisco Olarte.
From | Date | Subject | |
---|---|---|---|
Next Message | Karsten Hilbert | 2014-07-18 15:52:59 | Re: Petition: Treat #!... shebangs as comments |
Previous Message | John Cochran | 2014-07-18 15:49:17 | Re: Petition: Treat #!... shebangs as comments |