How to store output in a variable while using expect 'send' command

Viewed 36901

Thanks.

But the account and password are needed. So I must send them and then send ovs-vsctl command.

the scripts are something like this:

spawn telnet@ip 

expect -re "*login*" {
       send "root"
}

expect -re "password*" {
       send "****"
}

send "ovs-vsctl *******"

I want to store the output of this command send "ovs-vsctl ****", but many times I got some output of the command "send "password"", how can I get the output of send "ovs-vsctl****". The output of the command send "ovs-vsctl *** are two string and each string occupies one line.

Thanks.

2 Answers
Related