#!/bin/expect
set timeout -1 #不设置超时时间
spawn ssh 192.168.89.140
expect {
"yes/no" { send "yes\r";exp_continue }
"password:" { send "123\r";exp_continue }
"#" { send "hostname\r"
send "exit\r"}
}
interact
12-04
1325
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-03
1098
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-26
1153
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-27
442
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)