2

亲爱的 Stack Overflow 社区,

我遇到了一个 FORTRAN 可执行文件(如果有人知道的话,来自 Perple_X_6.8.5 的“构建”)需要通过我必须自动化的提示输入的问题。对于只需要一行作为答案的提示,我找到了以下解决方案:

./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:

这就是问题出现的地方。按照我对“简单”提示的初始解决方案,我将如何回答这个要求每行一个组件和一个“输入”以便跳转到下一个提示的提示?

我尝试了以下方法:

./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

请注意,这不是整个提示链中的最后一个提示。更多“简单”和更多“列表”提示随之而来。

4

1 回答 1

2

(首先作为评论发布,但其他人认为这是答案)

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

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

于 2018-12-05T08:35:08.047 回答