如何回答每行包含多个答案的交互式提示

How to answer interactive prompt that includes multiple answers per line

亲爱的 Stack Overflow 社区,

我在使用 FORTRAN 可执行文件(来自 Perple_X_6.8.5 的 "build" 以防万一有人知道)时遇到问题,它需要通过我必须自动执行的提示进行输入。对于只需要一行作为答案的提示,我找到了以下解决方案:

./build << EOF
test                  `# Problem name deifnition`
hp02ver.dat           `# Declaration of the data base to be used`
perplex_option.dat    `# Declaration of the computational option file (default)`
N                     `# Tranform the data base components? (No)`
N                     `# Saturated fluids? (No)`
N                     `# Saturated components? (No)`
N                     `# chem. pot., activities, fugacities indipendet? (No)`
EOF

但是,下一个提示给了我一个组件列表,我必须从中选择:

Select thermodynamic components from the set:
NA2O  MGO   AL2O3   SIO2  K2O   CAO   TIO2  MNO   FEO   O2    H2O   CO2
Enter names, 1 per line, press <enter> to finish:

这就是问题所在。按照我对 "simple" 提示的初始解决方案,我将如何回答这个要求每行一个组件和 "enter" 以跳转到下一个提示的提示?

我尝试了以下方法:

./build << EOF
test                  `# Problem name deifnition`
hp02ver.dat           `# Declaration of the data base to be used`
perplex_option.dat    `# Declaration of the computational option file (default)`
N                     `# Tranform the data base components? (No)`
N                     `# Saturated fluids? (No)`
N                     `# Saturated components? (No)`
N                     `# chem. pot., activities, fugacities indipendet? (No)`
SIO2                  `# List of components`
TIO2
AL2O3
FEO
MNO
MGO
CAO
NA2O
K2O
H2O
EOF

返回此错误:

Fortran runtime error: Sequential READ or WRITE not allowed after EOF marker, possibly use REWIND or BACKSPACE

请注意,这不是整个提示链中的最后一个提示。更多 "simple" 和更多 "list" 提示也随之而来。

(第一次作为评论发布,但其他人认为这是答案)

程序要求Enter names, 1 per line, press <enter> to finish
每行都以 <enter> 结束,所以这里程序需要一个额外的 <enter>

在最后一个热力学分量之后(在 EOF 或其他输入之前)插入一个空行。