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

From John Cochran
Subject Re: Petition: Treat #!... shebangs as comments
Date
Msg-id CAGQU3n7qUHG2wPhdaAekPPQoAC0+sK9javV38uKH5yjyrTkaPw@mail.gmail.com
Whole thread Raw
In response to Re: Petition: Treat #!... shebangs as comments  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general

On Fri, Jul 18, 2014 at 11:32 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
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?

Snip ... 


Actually, it wouldn't. Andrew's request is to be able to take advantage of Unix's method of using all text after a #! on the first line of a file to actually mean to execute the program mentioned after the #! and then feed the file to mentioned program. So having a script file like

select * from foo;

modified to

#!/usr/local/pgsql/bin/psql
select * from foo;

would result in a file that could be executed directly on an Unix platform, yet still be capable of being using on a Window's platform using the 'psql -f file' style of execution.

Sounds like a good idea. A more generic approach is to have '#' itself be a comment delimiter. But I suspect doing such would be in conflict with the SQL standard.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Petition: Treat #!... shebangs as comments
Next
From: Francisco Olarte
Date:
Subject: Re: Petition: Treat #!... shebangs as comments