title: How to capture output of expect script command with expect_out?
body: <pre><code>#!/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
  </code></pre>
  
  <p>The output of loadtime command looks like "Load Time: 2.45"
  However, on executing the script, $accum only displays "loadtime" and not "Load Time: 2.45" </p>
  
  <p>How to capture output of loadtime command in variable or local file?</p>