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

Поиск
Список
Период
Сортировка
От John Cochran
Тема Re: Petition: Treat #!... shebangs as comments
Дата
Msg-id CAGQU3n7qUHG2wPhdaAekPPQoAC0+sK9javV38uKH5yjyrTkaPw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Petition: Treat #!... shebangs as comments  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general

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

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Petition: Treat #!... shebangs as comments
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: Petition: Treat #!... shebangs as comments