0

I was debugging the expect script wherein i came across a line which was giving me incomplete output.

./worldbox.exp 30.30.30.30 username password 7 > /tmp/30.30.30.30.txt

For value 7, the code in worldbox.exp looks like below.

elseif {[lindex $argv 3] == 7} {   
     expect {   
            timeout {    
                  puts "Connection timed out"    
                  exit 1   
            }   
            "yes/no" {    
                    send "yes\r"    
                    exp_continue    
            }   
            "password:" {     
                    send -- "[lindex $argv 2]\r"    
                    exp_continue    
            }    
            "log_echo" {    
                    send "dvreng list-ipg\rexit\r"    
                    exp_continue    
            }    
    interact    
    }   
}

Now when i execute the command (dvreng list-ipg) manually, I am getting the complete output. But when I
run the script, I am getting incomplete output. I want to know how to get the complete output via expect script.

alani
  • 12,573
  • 2
  • 13
  • 23
Murali Go
  • 29
  • 8

1 Answers1

1

The "interact" there is a pattern for expect, not a command.

  • remove the "exp_continue" from the "log_echo" block
  • put "interact" after the closing brace of the expect command.
glenn jackman
  • 238,783
  • 38
  • 220
  • 352