expect无交互操作
发布时间:2020-12-14 05:17:31 所属栏目:大数据 来源:网络整理
导读:#!/usr/bin/ expectset ip ‘ 192.168.4.5 ‘ set pwd ‘ 123456 ‘ set timeout 30 spawn ssh [email?protected]$ip expect { " yes/no " {send " yesr " ;exp_continue} " password: " {send " $pwdr " }}interact # 保持在远程终端# !/usr/bin/ expects
#!/usr/bin/expect set ip ‘192.168.4.5‘ set pwd ‘123456‘ set timeout 30 spawn ssh [email?protected]$ip expect { "yes/no" {send "yesr";exp_continue} "password:" {send "$pwdr"} } interact # 保持在远程终端 #!/usr/bin/expect set ip [lindex $argv 0] # 第一个位置参数 set user [lindex $argv 1] set pwd [lindex $argv 1] set timeout 30 spawn ssh [email?protected]$ip expect { "yes/no" {send "yesr";exp_continue} "password:" {send "$pwdr"} } interact # 保持在远程终端 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |