user788171
user788171

Reputation: 17553

continue script after expect{exp_continue}

I have bash code that looks like the following:

/usr/bin/expect -c '
    spawn python Tools/python/install.py
    expect {
        -nocase "password:" {
            send "$env(PASS)\r"
            exp_continue
        }
    }
    interact
'

This code seems to work except for the fact that after it submits the passwords, it hangs. After this block of code, there is more code I want to execute in my script. Is there a way to get expect to drop me back into the bash script to continue execution of lines below this block of code?

Upvotes: 1

Views: 13192

Answers (1)

Jonah Bishop
Jonah Bishop

Reputation: 12571

(Just to formally answer this question)...

I'm guessing the interact command is biting you. From the man page:

interact gives control of the current process to the user, so that keystrokes are sent to the current process, and the stdout and stderr of the current process are returned.

I would try either of these:

  • Remove the interact command
  • Issue the command in the background using & or screen

Based on your comment, it looks like the former was what worked.

Upvotes: 2

Related Questions