Murali Go
Murali Go

Reputation: 29

Shell script output is incomplete

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.

Upvotes: 0

Views: 217

Answers (1)

glenn jackman
glenn jackman

Reputation: 247250

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.

Upvotes: 1

Related Questions