我正在尝试解决我提出的问题这里使用expect
脚本而不是文件重定向。不幸的是,这个解决方案效果不佳(与上面问题中描述的行为相同:我必须./driver.exp
多次运行下面的脚本才能获得预期的结果。
这是错误消息:
...
Input > QUIT
send: spawn id exp4 not open
while executing
"send "VOPT\n""
(file "./driver.exp" line 33)
(完整的标准输出输出可以找到这里)
这是我的driver.exp
文件:
#!/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
您能帮我理解为什么会发生这种情况吗?
我感谢您的帮助