Re: Petition: Treat #!... shebangs as comments

From: John Cochran <j69cochran(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Petition: Treat #!... shebangs as comments
Date: 2014-07-18 15:49:17
Message-ID: CAGQU3n7qUHG2wPhdaAekPPQoAC0+sK9javV38uKH5yjyrTkaPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 18, 2014 at 11:32 AM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2014-07-18 15:51:35 Re: Petition: Treat #!... shebangs as comments
Previous Message Adrian Klaver 2014-07-18 15:32:53 Re: Petition: Treat #!... shebangs as comments