expect
Posted ilifeilong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了expect相关的知识,希望对你有一定的参考价值。
#!/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 "yes " } "*password:" { send "${passwd} " } "Permission denied, please try again." { exit } "Connection refused" { exit } timeout { exit } eof { exit } } expect "*$" send "hostname " expect "*$" send "exit " expect eof _EOF
以上是关于expect的主要内容,如果未能解决你的问题,请参考以下文章
分发系统-expect讲解,expect脚本远程登录,expect脚本远程执行命令,expect脚本
七十分发系统介绍expect脚本远程登录expect脚本远程执行命令expect传递参数