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

From Andrew Pennebaker
Subject Re: Petition: Treat #!... shebangs as comments
Date
Msg-id CAHXt_SW+0VNmNhgU=kewUis76-Gx9JLz-kyebp33GoEbSnFc6A@mail.gmail.com
Whole thread Raw
In response to Re: Petition: Treat #!... shebangs as comments  (Martin Gudmundsson <martingudmundsson@gmail.com>)
Responses Re: Petition: Treat #!... shebangs as comments  (John McKown <john.archie.mckown@gmail.com>)
Re: Petition: Treat #!... shebangs as comments  (Francisco Olarte <folarte@peoplecall.com>)
List 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@gmail.com> wrote:

18 jul 2014 kl. 17:31 skrev Dennis Jenkins <dennis.jenkins.75@gmail.com>:

On Fri, Jul 18, 2014 at 10:16 AM, Andrew Pennebaker <andrew.pennebaker@gmail.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

pgsql-general by date:

Previous
From: Martin Gudmundsson
Date:
Subject: Re: Petition: Treat #!... shebangs as comments
Next
From: Karsten Hilbert
Date:
Subject: Re: Petition: Treat #!... shebangs as comments