Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spawn_id: spawn id exp6 not open

I know that this issue is already mentioned here, but the solution does not work for me.

I have this script (let's name it myscript.sh) that spawns a process on remote environment and that should interact with it.

#!/usr/bin/expect
log_user 0
set timeout 10
spawn ssh -o PubkeyAuthentication=no [lindex $argv 0] -n [lindex $argv 1]
expect "password:" {send "mypassword\r"}
expect "Continue to run (y/n)" {send "n\r"}
interact

When I call this script on local environment...

myscript.sh user@host "command1;./command2 parameter1 parameter2"

I get the above error at line 7 (interact)

Any ideas??

like image 322
Eedoh Avatar asked Sep 20 '11 19:09

Eedoh


1 Answers

I suspect the expect is not able to find out(matching) the pattern you are sending.

expect "password:" {send "mypassword\r"}
expect "Continue to run (y/n)" {send "n\r"}

Check out again whether the "password:" and "Continue to run (y/n)" are in correct CAPS.

If still getting the same error, you can try using regular expression.

like image 52
sankar guda Avatar answered Oct 19 '22 08:10

sankar guda