#!/usr/bin/expect -f set dtime [lindex $argv 0 ] set password 111111 set timeout 3000; spawn /usr/bin/scp /software/databk/$dtime.sql cdczhangg@10.151.254.25:/software/mysqldata/ #spawn ssh cdczhangg@10.151.254.25 expect { "*yes/no" {send "yes\r";exp_continue} "*password:" {send "$password\r"} } interact
转载于:https://blog.51cto.com/dubin/1629076