Dear Stack Overflow community,
I am having trouble with a FORTRAN executable ("build" from Perple_X_6.8.5 in case anybody knows that) that requires input via prompts which I have to automate. For the prompts that only require one line as an answer I found the following solution:
./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
However, the next prompt gives me a list of components from which I have to chose:
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:
That is where the problem arises. How would I, following my initial solution for "simple" prompts, answer this prompt that requires one component per line a an "enter" in order to jump to the next prompt?
I tried the following:
./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
which returned this error:
Fortran runtime error: Sequential READ or WRITE not allowed after EOF marker, possibly use REWIND or BACKSPACE
Please note that this is not the last prompt in the whole chain of prompts. More "simple" and more "list" prompts follow suit.
(First posted as a comment, but others think it is the answer)
The program asks for Enter names, 1 per line, press <enter> to finish
.
Each line is finished with an <enter>
, so here the program wants an additional <enter>
.
Insert an empty line after the last thermodynamic component (before EOF or other input).