0

Normally when in interactive mode, when I type in exit, it displays Disconnected from Virtual Machine 'pick0:LINUX' and then returns to the bash shell prompt.

With my expect script, it is stuck on Disconnected from Virtual Machine 'pick0:LINUX' after issuing the exit command. Here's my expect script:

#!/usr/bin/expect -f
set timeout -1
spawn /usr/bin/d3 -0

expect "Options: F)ile only, A)BS only, X) eXecute. Q)uit = "
send -- "f"

expect "Are you sure that the restore media has been verified? Confirm (y/n)"
send -- "y"

expect "All data on disk will be erased. Confirm (y/n)"
send -- "y"

expect "Enter a unit number from the above list: "
send -- "1\r"

expect "Do you wish to disable file reallocation (y/<n>)?  "
send -- "n\r"

expect "Load volume #1 and press <Enter>"
send -- "\r"

expect "Restore from incremental save tape (y/n)?"
send -- "n\r"

expect "Restore from transaction log tape (y/n)"
send -- "n\r"

expect "Enter your user id: "
send -- "dm\r"

expect "master dictionary: "
send -- "dm\r"
send -- "exit\r"

expect eof

1 Answer 1

1

Apparently sending an exit isn't enough to exit whatever process you've spawned. You might want to expect "Disconnected from Virtual Machine" and then just exit the expect script without waiting for eof. Or change the timeout value to a non-infinite value before expecting eof.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.