Loops 我需要帮助在expect中创建一个循环

Loops 我需要帮助在expect中创建一个循环,loops,if-statement,tcl,expect,cisco,Loops,If Statement,Tcl,Expect,Cisco,我需要帮助在expect中创建一个循环。我有一个脚本,可以将ssh生成cisco路由器,并执行“show call active voice brief”命令。我需要捕获所有的输出,但问题是当屏幕被填满时,它会停止,需要我按空格键才能看到其余的输出。输出的长度并不总是相同的。这意味着我必须按空格的次数不同。这是我需要循环的内容>>> expect “*More*” #this means the screen is full and I need to press space to see mo

我需要帮助在expect中创建一个循环。我有一个脚本,可以将ssh生成cisco路由器,并执行“show call active voice brief”命令。我需要捕获所有的输出,但问题是当屏幕被填满时,它会停止,需要我按空格键才能看到其余的输出。输出的长度并不总是相同的。这意味着我必须按空格的次数不同。这是我需要循环的内容>>>

expect “*More*” #this means the screen is full and I need to press space to see more output

send – “ “
那么我如何循环这个

expect "*More*" {send " "} \
    "*RTsedeVoIP_GW1#*" {send -- "exit\r"}
expect "*More*" {send " "} \
    "*RTsedeVoIP_GW1#*" {send -- "exit\r"}
expect "*More*" {send " "} \
    "*RTsedeVoIP_GW1#*" {send -- "exit\r"}
expect "*More*" {send " "} \
    "*RTsedeVoIP_GW1#*" {send -- "exit\r"}
expect "*More*" {send " "} \
    "*RTsedeVoIP_GW1#*" {send -- "exit\r"}
expect "*More*" {send " "} \
    "*RTsedeVoIP_GW1#*" {send -- "exit\r"}
expect "*More*" {send " "} \
    "*RTsedeVoIP_GW1#*" {send -- "exit\r"}
expect "*More*" {send " "} \
    "*RTsedeVoIP_GW1#*" {send -- "exit\r"}
expect "*More*" {send " "} \
    "*RTsedeVoIP_GW1#*" {send -- "exit\r"}
像这样:

expect {
    "*More*" {send " "; exp_continue} 
    "*RTsedeVoIP_GW1#*" {send -- "exit\r"}
}

exp\u continue
命令本质上是当前
expect
命令中循环的“重做”。

好吧,我还没有看到在代码中使用智能引号。您应该首先使用纯双引号。我知道,我在脚本中使用纯引号。问题,如果它与RTsedeVoIP不匹配,它会尝试匹配更多吗?还是会停止?从我得到的输出来看,它似乎与morre没有发送“”匹配,然后停止。