[gmx-users] Re:Shell scripts

lloyd riggs lloyd.riggs at gmx.ch
Thu Jul 5 18:03:23 CEST 2012


Dear All,

So I am using some scripts to parse through 100s of files using bash and awk.  In any case, I run into a problem as follows;  I have Ubuntu at home on my PC and I have a laptop at work with Ubuntu, same versions libraries, everything.  When I run the scripts at home they work fine, when I run them at the Ubuntu at work I get errors ranging from "Bad for loop variable" all the way to an infanite done at end of line no matter how much you type done.

Does any one know why, or have some other scripts...

Examples of just parsin energy files:

#!/bin/bash
i=1
for ((i=1;i<=1322;i+=1)); do
g_energy -f traj_${i}.edr -o ${i}.xvg << EOF
${i}
EOF
done

or infanite loops

#!/bin/bash
i=1
for (( ; ;)); do
g_energy -f traj_${i}.edr -o ${i}.xvg << EOF
${i}
EOF
done

or range

#!/bin/bash

for i {1..2121} ; do
g_energy -f traj_${i}.edr -o ${i}.xvg << EOF
${i}
EOF
i=$(($i+1))
done

or while loop

#!/bin/bash
i=1while [ i -le 2121 ]; do
g_energy -f traj_${i}.edr -o ${i}.xvg << EOF
${i}
EOF
done

Ill forgo the awk or cat extensions,

does anyone know why? Or have some other pasing scripts they've jimmied?

Stephan



More information about the gromacs.org_gmx-users mailing list