在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
复制代码 代码如下: #!/usr/bin/expect -f set ipaddress [lindex $argv 0] set passwd [lindex $argv 1] set timeout 30 spawn ssh root@$ipaddress #expect "yes/no" #send "yesr" expect "password:" send "$passwdr" expect "]*" send "mkdir -p /tmp/haha/haha2r" send "exitr" *************** expect { "(yes/no)?" { send "yesn" } "password:" { .... } 判断语句 if {$havepass == 0} { expect "password:" { send "$pwn" } } 或者: expect { "yes/no" { send "yesr"; exp_continue} "password:" { send "$passwdr" } } |
请发表评论