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

From: Andrew Pennebaker <andrew(dot)pennebaker(at)gmail(dot)com>
To:
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Petition: Treat #!... shebangs as comments
Date: 2014-07-18 19:37:12
Message-ID: CAHXt_SW+0VNmNhgU=kewUis76-Gx9JLz-kyebp33GoEbSnFc6A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

As a workaround, I can use this shebang hack:

$ cat hello.psql
--() { :; }; exec psql -f "$0"

SELECT 'Hello World!';

$ ./hello.psql
?column?
--------------
Hello World!
(1 row)

$ psql -f hello.psql
?column?
--------------
Hello World!
(1 row)

But I would prefer to use a traditional (#!/usr/bin/env psql -f) shebang.
It took a few hours on irc to hack this one together.

On Fri, Jul 18, 2014 at 2:28 PM, Martin Gudmundsson <
martingudmundsson(at)gmail(dot)com> wrote:

>
> 18 jul 2014 kl. 17:31 skrev Dennis Jenkins <dennis(dot)jenkins(dot)75(at)gmail(dot)com>:
>
> On Fri, Jul 18, 2014 at 10:16 AM, 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
>>
>> While still allowing the traditional (and Windows compatible) style:
>>
>> psql -f script.psql
>>
>>
> +1
>
>
> +1, Sounds great!
> Even though you can accomplish most things in other ways, this seems like
> the easiest in many scenarios.
>
>
>

--
Cheers,

Andrew Pennebaker
www.yellosoft.us

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2014-07-18 19:43:42 Re: Petition: Treat #!... shebangs as comments
Previous Message Martin Gudmundsson 2014-07-18 19:28:25 Re: Petition: Treat #!... shebangs as comments