swpan&expect交互脚本

#!/usr/bin/expect
set timeout 30
set user USERNAME
set pass PASSWORD
spawn sudo pg_dump npi -U admin -p PORT -h IP -f /home/pgsql_bak/
expect {
"Password" {send "$pass\r"}
}
expect eof

posted @ 2019-01-04 14:04  噔噔蹬蹬  阅读(616)  评论(0编辑  收藏  举报