O código que você está tentando executar parece estar na sintaxe do C-shell, ao invés da família Bourne de shells.
Você pode instalar e usar um shell C - por exemplo, o tcsh
package
sudo apt-get install tcsh
csh
ou converta o código em seu bash
equivalente: o seguinte não foi testado, pois não tenho acesso ao seu arquivo de entrada, mas deve estar próximo
for f in tmp*; do
echo "$f"
zid="$(grep ZINC "$f")"
if [ -e "${zid}.mol2" ]; then
filename="${zid}.mol2"
else
for n in {01..99}; do
if [ -e "${zid}_${n}.mol2" ]; then
filename="${zid}_${n}.mol2"
break;
fi
done
fi
mv -v "$f" "$filename"
done