#!/usr/bin/expect -f
spawn telnet IP PORT
expect "Escape character is '^]'"
send loadtime
set accum {}
expect {
-regexp {..*} {
append accum "${accum}$expect_out(0,string)"
exp_continue
}
}
puts $accum
loadtime 命令的输出看起来像 "Load Time: 2.45" 但是,在执行脚本时,$accum 只显示 "loadtime" 而不是 "Load Time: 2.45"
如何在变量或本地文件中捕获加载时间命令的输出?