Shebang for psql

后端 未结 2 1194
春和景丽
春和景丽 2021-02-08 13:11

I\'m trying to write PostgreSQL script(s) but having a problem with shebang line

#! /usr/bin/psql [ psql_args_here ] -f

select now();

This giv

2条回答
  •  [愿得一人]
    2021-02-08 13:45

    There is a even better solution. The first line should be:

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

    It works as a regular shebang #!

    http://rosettacode.org/wiki/Multiline_shebang#PostgreSQL

提交回复
热议问题