0

Im using an expect script to say xyz.exp to login to a remote host and execute another script abc.sh

Now most of the times abc.sh runs fine, but there is a scenario where if a certain condition is not fulfilled, the script stops and needs couple of user inputs and then resumes.

Is there any way to handle this situation such that the expect script xyz.exp can interactively solve this issue as well ?

If this does occur both the scripts hang and I've to close the terminal and do some rework.

1
  • 1
    Thats exactly what expect is for. You may have to add some code of the script, so we can help you.
    – chaos
    Mar 3, 2015 at 7:43

1 Answer 1

0

You'll change

expect "something that you already expect"

to

expect {
    "this happens sometimes" {
        send -- "some input\r"
        exp_continue
    }
    "something that you already expect"
}
1
  • When we expect in the form : expect { "this happens sometimes" { send -- "some input\r" exp_continue } "something that you already expect" } Does this mean it'll work only when that condition arises and it won't hang expecting that right ?
    – user417721
    Mar 4, 2015 at 4:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .