A series of commands in a script

GROMACS version:
GROMACS modification: Yes/No
Here post your question
I want to write a series of commands in a script and then run that script so that the commands are executed automatically.
How do I give the script as a command to Gromacs for this?
Thanks a lot

Just write a bash script in linux and put gromacs command in it. Here in the script below, I use bash + gromacs + pymol + awk and at the end I use gnuplot

#!/bin/bash
file_name="lut"
rm all_dihedral.txt all_potential.txt all_valence.txt

for i in {0..350..10};do
echo load lut_0.pdb >> pymol_$i.pml; echo set_dihedral id 58, id 59, id 61, id 63, $i >> pymol_$i.pml; echo set retain_order, 1 >> pymol_$i.pml; echo save lut_$i.pdb >> pymol_$i.pml; pymol -c pymol_$i.pml; done


for index in {0..350..10}; do  
gmx editconf -f ${file_name}_$index.pdb -o ${file_name}_$index.gro -box    4.96470   4.96470   4.96470
done


for index in {0..350..10}; do   
awk -v a=$index '{if (NR==6) {$6=a; print} 
else { print}}' topol.top | tee topol_$index.top
done

for index in {0..350..10}; do  
gmx grompp -f minim.mdp -c ${file_name}_$index.gro -r ${file_name}_$index.gro -p topol_$index.top -o em_${file_name}_$index.tpr
gmx mdrun -deffnm em_${file_name}_$index -v
done

for index in {0..350..10}; do   
gmx grompp -f md.mdp -c em_${file_name}_$index.gro -r em_${file_name}_$index.gro -p topol_bez_wiezow.top -o eq1_${file_name}_$index.tpr
gmx mdrun -deffnm eq1_${file_name}_$index -v
done


for index in {0..350..10}; do   
echo '10'| gmx energy -f eq1_${file_name}_$index.edr -s eq1_${file_name}_$index.tpr -o potential_lut_$index.xvg
done

for index in {0..350..10}; do   
gmx angle -f eq1_${file_name}_$index.gro -n torsional_C5_C6_C7_C8.ndx -type dihedral -ov dihedral_lut_$index.xvg
done

for index in {0..350..10}; do   
awk 'NR==18 {print $2} ' dihedral_lut_$index.xvg >> all_dihedral.txt
done

for index in {0..350..10}; do   
awk 'NR==25 {print $2} ' potential_lut_$index.xvg >> all_potential.txt
done

var=$(sort -n -k 1 all_potential.txt | head -n 1)

awk -v min=$var '{$1=(($1-min)/4.184); print}' all_potential.txt | tee all_potential_0_normalization_kcal.txt
paste all_dihedral.txt all_potential_0_normalization_kcal.txt > dihedral_energy.txt
sort -k1 -n dihedral_energy.txt > dihedral_energy_sorted.txt

for index in {0..350..10}; do   
gmx angle -f eq1_${file_name}_$index.gro -n valence_C3_C6_C7.ndx -ov valence_lut_$index.xvg
done

for index in {0..350..10}; do   
awk 'NR==18 {print $2} ' valence_lut_$index.xvg >> all_valence.txt
done
paste all_dihedral.txt all_valence.txt > dihedral_valence.txt
sort -k1 -n dihedral_valence.txt > dihedral_valence_sorted.txt

gnuplot dihedral_energy.gpl
gnuplot dihedral_valence.gpl