Hello All,
I have an Expect Script that ssh'es to a server and does some stuff.
In Expect there is a built-in Array Variable called "expect_out(buffer)" which contains all the output from the previous send command up until the expected output.
I want to pass the array "expect_out(buffer)" to a Procedure/Function I have.
After I pass the array I have a loop that I use to loop through each element line by line.
I am able to successfully do this loop outside of the Procedure using that expect_out(buffer) array...
So how can I convert this code below, to use a new array variable argument in the procedure?
### This loop works outside of this procedure...
foreach line [split $expect_out(buffer) "\n"] {
send_user "Line = $line\n"
}
So how can I basically do the same thing as above, but this time I have to change the split function to use this new Array Variable "outputArray" that had "expect_out(buffer)" passed into it?
proc save_outputBuffer { outputArray } {
foreach line [ split *NEW ARRAY* "\n"] {
send_user "LINE = $line\n"
}
return $outputArray
}
I've tried a couple of different ways to do the split command but nothing seems to work...
Any thoughts would be great!
Thanks in Advance,
Matt