现在位置: 首页 > expect
2018年03月05日 Vultr教程 ⁄ 共 409字 如何利用expect实现自动登录到多台服务器已关闭评论 ⁄ 阅读 1,360 views 次
shell脚本,具体代码如下: #!/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:" { s...
阅读全文

最新优惠

×