#!/bin/bash for i in `seq 0 5` do YEAR=$((i + 2010)) YEAR_STOP=$((YEAR + 1)) echo $YEAR_STOP for template in Templates/venus_XXXX.xml do if [[ -f $template ]] then IFS='_/. ' read -r -a array <<< $template target=${array[1][1]} request=$target"_"$YEAR".xml" sed "s/XXXX/$YEAR/g;s/YYYY/$YEAR_STOP/g" $template > Requests/$request python Bin.py/run.py $target Requests/$request $YEAR_STOP-01-01T00:00:00.000Z else echo -100 fi done done