expect
发布时间:2020-12-14 03:50:19 所属栏目:大数据 来源:网络整理
导读:#!/bin/ bash passwd = ‘nihao23d23d ‘ /usr/bin/expect _EOFspawn ssh -p22 [email?protected] 10.189 . 103.12 expect { " Are you sure you want to continue connecting (yes/no)? " { send " yesr " } " *password: " { send " ${passwd}r " } " Pe
#!/bin/bash passwd=‘nihao23d23d‘ /usr/bin/expect << _EOF spawn ssh -p22 [email?protected]10.189.103.12 expect { "Are you sure you want to continue connecting (yes/no)?" { send "yesr" } "*password:" { send "${passwd}r" } "Permission denied,please try again." { exit } "Connection refused" { exit } timeout { exit } eof { exit } } expect "*$" send "hostnamer" expect "*$" send "exitr" expect eof _EOF (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |