I am trying to solve my question that I've asked here 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)
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
QUIT, the construct2d program quits. And then the nextsendfails because there's no running process to talk to.autoexpectto generate the expect code.construct2d*