#!/bin/bash /usr/bin/expect << EOF spawn /usr/local/pgsql/bin/2.sh expect "*postgres:" send "postgres " 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