我有一个期望的脚本工作正常,但它在一些命令后停止。
脚本: #!的/ usr / bin中/期望
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
我尝试删除一些命令,但它总是停止!
答案 0 :(得分:0)
尝试在命令之间设置一个休眠期
Sleep 1
之前发生在我身上,我通过在命令之间使用1秒钟来修复它
答案 1 :(得分:0)
尝试在脚本的开头添加 设置超时-1
答案 2 :(得分:0)
尝试使用
set timeout -1
可能会达到默认超时时间并停止 将超时设置为-1会使其无限