#!/usr/bin/expect
set timeout 5
spawn ssh 192.168.6.136 -p 1024
expect {
"Connection refused" exit
"Name or service not known" exit
"continue connecting" {send "yes\r";exp_continue}
"password:" {send "123passwd\r";exp_continue}
"Last login" {send " ifconfig |grep eth0 -A3\n"}
}
expect eof
exit
expect分支,mark
最新推荐文章于 2024-04-01 19:36:36 发布