Need to run something remotely and am using
Expect which works. However, there are times
when I'm prompted differently and I'm unsure
how to get around it.
For example:
at times prompted:
(yes/no)?
Password:
other times prompted:
Password:
To account for this I've used:
This works fine, except after the first password
is entered the program runs and after a few
minutes there is a second password prompt.
Adding another expect "Password:" { send "mypwd\r" }
doesn't work.
For example:
This doesn't work and it sits waiting for the
password to be entered.
If it doesn't prompt for yes/no then this works:
How do I answer the second password prompt if
there is an initial yes/no?
Thanks!
Expect which works. However, there are times
when I'm prompted differently and I'm unsure
how to get around it.
For example:
at times prompted:
(yes/no)?
Password:
other times prompted:
Password:
To account for this I've used:
Code:
expect {
"(yes/no)?" { send "yes\r" }
"Password:" { send "mypassword\r" }
}
set timeout -1
This works fine, except after the first password
is entered the program runs and after a few
minutes there is a second password prompt.
Adding another expect "Password:" { send "mypwd\r" }
doesn't work.
For example:
Code:
expect {
"(yes/no)?" { send "yes\r" }
"Password:" { send "mypassword\r" }
}
set timeout -1
expect "Password:" { send "mypassword\r" }
set timeout -1
This doesn't work and it sits waiting for the
password to be entered.
If it doesn't prompt for yes/no then this works:
Code:
expect "Password:" { send "mypassword\r" }
set timeout -1
expect "Password:" { send "mypassword\r" }
set timeout -1
How do I answer the second password prompt if
there is an initial yes/no?
Thanks!