'expect'コマンドを使用して対話型プログラムを実行すると失敗します。

'expect'コマンドを使用して対話型プログラムを実行すると失敗します。

私が要求した問題を解決しようとしています。ここexpectファイルリダイレクトの代わりにスクリプトを使用してください。残念ながら、このソリューションは正しく機能しません。 (上記の質問で説明したのと同じ動作です。./driver.exp予想される結果を得るには、以下のスクリプトを複数回実行する必要があります。

エラーメッセージは次のとおりです。


...

 Input > QUIT
send: spawn id exp4 not open
    while executing
"send "VOPT\n""
    (file "./driver.exp" line 33)

(すべてのstdout出力は次のようになります。ここ)

これは私の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

なぜこれが起こるのかを理解するのに役立ちますか?

ご協力ありがとうございます

ベストアンサー1

おすすめ記事