expect_安装及脚本写法

yum install tcl-devel
yum install expect

参考代码  写法一定要标准 否则报错
expect_安装及脚本写法_第1张图片

#!/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

 

你可能感兴趣的:(expect_安装及脚本写法)