在当前的草稿脚本中,show
命令的输出很好,但是一旦我按下“ conf”命令,输出就会被压在一起。我该如何解决?
set timeout 20
spawn ssh -l manager 192.168.41.10.10
expect "manager@192.168.10.10's password:"
send "admin\r"
expect "Press any key to continue"
send "j"
log_file hp.log
send "show vlan 10\r"
expect "newsw*"
send "conf\r"
expect "newsw*(config)"
send "\r"
send "vlan 45\r"
expect "newsw*"
send "tagged 3\r"
send "exit\r"
send "exit\r"
这是“ conf”部分和相关命令的日志外观。输出一起运行。您可以在末尾看到一部分“ show vlan 45”。
newswitch# confnewswitch(config)# vlan 45newswitch(vlan-45)# tagged 3newswitch(vlan-45)# exitnewswitch(config)# exitnew$ Status and Counters - VLAN Information - VLAN 45
VLAN ID : 45
Name : VLAN45
这是正确的/所需的输出。我认为它看起来像这样:
newswitch#
conf
newswitch(config)# vlan 45
newswitch(vlan-45)# tagged 3
newswitch(vlan-45)# exit
newswitch(config)# exit
newswitch$ show vlan 45 ....and so forth