Bash percentage calculate snippet

MEMLINE=$( tac $MGRBASE/$REL_LOGLOC/server.status.log | egrep -m1 '\*\*.*Memory Status:' )
USED=$( echo "$MEMLINE" | egrep -o '[0-9\.,]+ MB Used' | sed 's/\..*//;s/,//' )
MAX=$(  echo "$MEMLINE" | egrep -o '[0-9\.,]+ MB Max'  | sed 's/\..*//;s/,//' )

PERC=$( printf "%.0f" $(echo "scale=2;($USED/$MAX)*100" | bc) )
if [[ $PERC -gt $MEM_CRIT_PERC ]]; then
  ERRORS="$ERRORS memory ${PERC}%"
elif [[ $PERC -gt $MEM_WARN_PERC ]]; then
  WARNINGS="$WARNINGS memory ${PERC}%"
fi