scp拷贝expect 自动交互脚本

#!/bin/bash
data=`date +%F`
/usr/bin/expect <<-EOF
set time 30
spawn scp root@192.168.1.2:/data/mysql_backup/"$data".sql.gz  /data/bigmysql/big213
expect {
"*yes/no" { send "yes\r"; exp_continue }
"*password:" { send "H8^eD4^kE5!h\r" } #双引号里面是密码
}
expect eof
EOF

我来吐槽

*

*