Posted to tcl by pocketprotector at Wed Mar 21 18:18:24 GMT 2018view raw
- I am embedding an expect script in a bash script, thats why you see Bash variables.
- 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.
- I tried adding the match_max, but that doesnt seem to have any effect.
- match_max 9000
- set expect_out(buffer) {}
- expect {
- "*#\ " {
- if {${VERBOSE} == 1} { puts "${server}: verbose: Received output, parsing" }
- set buffer [ split \$expect_out(buffer) '\n' ]
- foreach line \$buffer {
- switch -glob -- \$line {
- "bash*#\ " { continue }
- "*root*#\ " { continue }
- {${COMMAND}} { continue }
- default {puts "${server}: \$line" }
- }
- }
- if {${VERBOSE} == 1} { puts "${server}: verbose: closing session" }
- exit 0
- }
- timeout {
- puts "${server}: error: pbrun: timeout while waiting for command output"
- exit 1
- }
- }