expect to run a script file to perform database operations postgres

#!/bin/bash
/usr/bin/expect  << EOF
spawn /usr/local/pgsql/bin/2.sh
expect "*postgres:"
send "postgres\r"
set timeout 7200
expect eof
EOF

2.sh

#!/bin/bash /usr/local/pgsql/bin/psql -h 192.168.16.26 -p 5432 -U postgres -W -c "select delete_collection_data()" bigdata

 

Guess you like

Origin www.cnblogs.com/kcxg/p/11571917.html
Recommended