用expect实现的自动登录到多台服务器的shell脚本
2013-02-25 00:00
2536 查看
#!/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" } }
相关文章推荐
- 用expect实现的自动登录到多台服务器的shell脚本
- shell脚本通过expect实现自动单边无密登录功能
- Shell脚本实现自动输入密码登录服务器
- Shell脚本实现自动输入密码登录服务器
- Shell脚本实现自动输入密码登录服务器
- Shell脚本实现自动输入密码登录服务器
- linux使用shell脚本实现自动登录scp传输文件到其他服务器
- shell+expect实现多台服务器自动运行脚本。
- shell脚本通过expect实现自动单边无密登录
- shell中实现自动登录(bash环境脚本中)
- Shell 和 Expect 脚本的自动登录运行
- Shell脚本实现检查服务器安全状态(用户、登录IP、防火墙检查)
- ssh,expect脚本实现远程登录,拷贝命令scp,rsync服务器的搭建
- shell脚本通过expect脚本实现自动输入密码
- Shell脚本中调用expect,实现自动输入密码的功能
- shell脚本自动登录服务器
- Linux中使用expect脚本实现远程机器自动登录
- shell + expect 自动登录并执行脚本
- shell脚本实现ssh自动登录
- 【转】在shell脚本中利用expect实现自动应答