0

我有一个运行良好的期望脚本,但是在执行一些命令后它停止了。

脚本:#!/usr/bin/expect

eval spawn telnet Proc_m0_s1 8000

expect ">"

send "cd CLI/Processors\r"

expect ">"
send "getprocessorinfo Proc_m0_s5\r"
expect ">"
send "getprocessorinfo Proc_m0_s1\r"
expect ">"
send "getprocessorinfo Proc_m0_s7\r"
expect ">"
send "getprocessorinfo Proc_m0_s3\r"
expect ">"
send "getprocessorinfo Proc_m0_s17\r"
expect ">"
send "getprocessorinfo Proc_m0_s19\r"
expect ">"
send "getprocessorinfo Proc_m1_s5\r"
expect ">"
send "getprocessorinfo Proc_m1_s7\r"
expect ">"
send "getprocessorinfo Proc_m1_s9\r"
expect ">"
send "getprocessorinfo Proc_m1_s11\r"
expect ">"
send "getprocessorinfo Proc_m1_s13\r"
expect ">"
send "getprocessorinfo Proc_m1_s15\r"
expect ">"
send "getprocessorinfo Proc_m1_s17\r"
expect ">"
send "getprocessorinfo Proc_m1_s19\r"
expect ">"
send "getprocessorinfo Proc_m1_s21\r"
expect ">"
send "getprocessorinfo Proc_m1_s23\r"
expect ">"
send "getprocessorinfo Proc_m2_s1\r"
expect ">"
send "exit\r"

它像这样停止:

$ /CLI/Processors> getprocessorinfo Proc_m1_s23

我试过删除一些命令,但它总是停止!

4

3 回答 3

0

尝试使用

set timeout -1

它可能会达到默认超时期限并且停止将超时设置为 -1 使其无限

于 2013-12-16T09:41:06.813 回答
0

尝试在脚本的开头添加设置超时 -1

于 2013-11-16T18:33:34.053 回答
0

尝试在命令之间设置睡眠时间

Sleep 1

它以前发生在我身上,我通过在命令之间使用 sleep 1 seconds 来修复它

于 2013-07-29T23:17:26.790 回答