Posted to tcl by pocketprotector at Wed Mar 21 18:18:24 GMT 2018view raw

  1. I am embedding an expect script in a bash script, thats why you see Bash variables.
  2.  
  3. Basically, whats happening is that the head of the output returned from my command is being truncated. if i run "ls /var/log" for example, its never cut off at the same place twice. I would really truly appreciate any input on how to fix this.
  4.  
  5. I tried adding the match_max, but that doesnt seem to have any effect.
  6.  
  7. match_max 9000
  8. set expect_out(buffer) {}
  9.  
  10. expect {
  11. "*#\ " {
  12. if {${VERBOSE} == 1} { puts "${server}: verbose: Received output, parsing" }
  13. set buffer [ split \$expect_out(buffer) '\n' ]
  14. foreach line \$buffer {
  15.  
  16. switch -glob -- \$line {
  17. "bash*#\ " { continue }
  18. "*root*#\ " { continue }
  19. {${COMMAND}} { continue }
  20. default {puts "${server}: \$line" }
  21. }
  22. }
  23. if {${VERBOSE} == 1} { puts "${server}: verbose: closing session" }
  24. exit 0
  25. }
  26. timeout {
  27. puts "${server}: error: pbrun: timeout while waiting for command output"
  28. exit 1
  29. }
  30. }