Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> wrote:

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

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux