我必须从我的postgres数据库中获取数据转储。bash脚本:从shell脚本登录到postgres home
如何登录到postgres主页? 。我有以下的脚本,但它不工作:
#!/bin/sh$
export PASSWORD= something
echo $PASSWORD | sudo -S su postgres
pg_dump somedb > dump.txt+`date +%Y-%m-%d`
然而,当我运行此脚本,我没有得到记录到[email protected]:$
同时脚本不会引发错误。有什么我在这里做错了吗?
你的密码后跟一个换行符char? – demure
'''你的密码后面真的有空格吗? – Kevin