Scripting gmx pdb2gmx question

Dear all,

I want to automate MD runs and want to run:
pdb2gmx -f complex.pdb -o complex.gro and have GROMACS choose a custom forcefield and water model.

I tried:
echo -e 0 \n 1 | pdb2gmx -f complex.pdb -o complex.gro but this only selects the forcefield but not the water model I want. How can I automate this process?

Is usually use the delimiter EOF when multiple selections are needed, which should look something like this:
pdb2gmx -f complex.pdb -o complex.gro << EOF
0
1
EOF
In the case of choosing forcefields and water models, you could also just specify it in the command, which should look something like this:
pdb2gmx -f complex.pdb -o complex.gro -ff amber99bsc1 -water tip3p

To build on what @Karis said you can also use echo, however do no not pass the return character \n but rather call multiple instances of it, e.g.

( echo "firstargument" ; echo "secondargument" ) | gmx pdb2gmx ...

Thanks all! It worked