Using "expect" command to run an interactive program fails
0
votes
0
answers
503
views
I am trying to solve my question that I've asked [here](https://unix.stackexchange.com/q/609693/429557) using
expect
script instead of file redirection. Unfortunately, this solution doesn't work as well (the same behaviour as described in the question above: I have to run the script below ./driver.exp
multiple times to get the expected result.
Here is the error message:
...
Input > QUIT
send: spawn id exp4 not open
while executing
"send "VOPT\n""
(file "./driver.exp" line 33)
(The full stdout output can be found [here](https://gist.github.com/SignificantCell2/505fb7bd5fd2085895f3472585c5c470))
Here is my driver.exp
file:
#!/usr/bin/expect
spawn construct2d
expect "Input"
send "naca0012.dat\n"
expect "Command"
send "SOPT\n"
expect "Input"
send "NSRF\n"
expect "New value"
send "80\n"
expect "Input"
send "RADI\n"
expect "New value"
send "1\n"
expect "Input"
send "NWKE\n"
expect "New value"
send "1\n"
expect "Input"
send "QUIT\n"
expect "Command"
send "VOPT\n"
expect "Input"
send "JMAX\n"
expect "New value"
send "1\n"
expect "Input"
send "YPLS\n"
expect "New value"
send "5\n"
expect "Input"
send "RECD\n"
expect "New value"
send "1E5\n"
expect "Input"
send "QUIT\n"
expect "Command"
send "GRID\n"
expect "Input"
send "SMTH\n"
expect "Command"
send "QUIT\n"
interact
Could you please, help me understand why is this happening?
I appreciate your help
Asked by adhrar_nmatrous
(85 rep)
Sep 16, 2020, 07:08 PM