expect_安装及脚本写法
yum install tcl-devel
yum install expect
参考代码 写法一定要标准 否则报错 坑
#!/usr/bin/expect
spawn scp /maqingbin/3_ZmData.sql [email protected]:/maqingbin/expectTest
expect {
"*(yes/no)" {
send "yes\n"
expect "password:" { send "xxxpasswordxxx\r"}
}
"password:" {
send "xxxpasswordxxx\r"
}
}
expect eof
exit