This is not the complete code, 2 first lines are only for "debug" purpose, I'm new on bash scripting and I don't know why if ls $ACTUAL/${BACKUP_DIR}/${NOMBRE}_*.tgz | wc -l returns 2 ,the script execute the then clause...
COPIAS=$(ls $ACTUAL/${BACKUP_DIR}/${NOMBRE}_*.tgz | wc -l)
echo ${COPIAS}
if [ $(ls $ACTUAL/${BACKUP_DIR}/${NOMBRE}_*.tgz | wc -l)>5 ]
then
echo "more than 5"
else
echo "5 or less"
fi