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

From: Frank Pinto <frank(at)ayalo(dot)co>
To: Martin Gudmundsson <martingudmundsson(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Petition: Treat #!... shebangs as comments
Date: 2014-07-18 17:25:20
Message-ID: CAATpuJqBfmOibXFxReEa-d16qEnhsc6A1SK9Ek9MMijdQbBWHw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I personally like Francisco Olarte's approach. Hashbang's don't support
arguments well (
http://stackoverflow.com/questions/4303128/how-to-use-multiple-arguments-with-a-shebang-i-e)
and being able to put JUST psql as the command to execute the script
doesn't scale across environments. Previously I've just used a quick
wrapper:

https://gist.github.com/frankpinto/3427cf769a72ef25ffac

It can be modified to accept arguments for the script name, run a sql
script by the same name, have a default environment, etc.

Frank

On Fri, Jul 18, 2014 at 10:43 AM, Martin Gudmundsson <
martingudmundsson(at)gmail(dot)com> wrote:

> +1
>
> Skickat från min iPhone
>
> > 18 jul 2014 kl. 17:58 skrev Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>:
> >
> >> On 07/18/2014 08:52 AM, Karsten Hilbert wrote:
> >> On Fri, Jul 18, 2014 at 08:32:53AM -0700, Adrian Klaver wrote:
> >
> >>
> >> I think the OP is talking about executable scripts so both of
> >>
> >> $> psql -f the-file.sql
> >>
> >> and
> >>
> >> $> ./the-file.sql
> >>
> >> (where the-file.sql starts with "#!/usr/bin/env psql")
> >>
> >> would work given that the-file.sql has got execute permission.
> >
> > Yea, it finally dawned on me what was being asked, so ignore my previous
> post.
> >
> >>
> >> Karsten
> >
> >
> > --
> > Adrian Klaver
> > adrian(dot)klaver(at)aklaver(dot)com
> >
> >
> > --
> > Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-general
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G Johnston 2014-07-18 17:41:30 Re: Petition: Treat #!... shebangs as comments
Previous Message David G Johnston 2014-07-18 17:19:50 Re: [ADMIN] Editable Views