I get the following error
./get_NE05: line 42: [: 4: unary operator expected
Line 42 corresponds to the second IF statement
while [ $I -le $2 ]
do
echo ${STRING_NAME[$J]}
J=1
if [ $I -lt 10 ]; then
EXT=0$I
else
EXT=$I
fi
while [ $J -le 4 ]
do
echo $I-$J
#calculating last occurrence
OCCURRENCE=`grep -io "${STRING_NAME[$J]}" ${1}-0${EXT}.out_bis| wc -l`
if [ $J -eq 1 ]; then
OLD_OCCURRENCE[$J]=${OCCURRENCE}
fi
if [ ${OCCURRENCE} -ne ${OLD_OCCURRENCE[$J]} ]; then
echo "error" $OCCURRENCE[$J] $OLD_OCCURRENCE[$J]
fi
J=`expr $J + 1`
done
I=`expr $I + 1`
done
echo your variables to see what values are currently assigned before that line. You can also use set -x/ set +x to check what is going on. You can also try out double brackets etc.