【问题标题】:Run Postgres Command from Shell Script从 Shell 脚本运行 Postgres 命令
【发布时间】:2013-11-03 03:41:50
【问题描述】:

我使用 Postgresql。我有命令

shp2pgsql -I -s 4269  /tmp/t/Wards.shp aa | psql  postgis;

当我输入 su postgres 并输入此命令时,它可以正常工作,但不能从 aa.sh 文件中获得

我的 aa.sh 是

su postgres; shp2pgsql -I -s 4269  /tmp/gismanager/Wards.shp aa | psql  postgis;

谁能帮帮我?

【问题讨论】:

    标签: linux bash postgresql shell postgis


    【解决方案1】:

    你可能想要类似的东西

    su posgres -c 'shp2pgsql… '
    

    su 命令执行特权 shell,它后面的所有内容都会在 shell 终止后执行。

    【讨论】:

      猜你喜欢
      • 2012-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多