I have a script that pulls 10 numbers from a database. I need to add the 10 numbers together then divide by 10 to get the average of the 10 numbers. I have a FOR loop in place to calculate by I am having trouble with my code.
Here is a sample of 10 of the values stored in $MON10
MON10="$($MYSQL -u$LSQLUSER -p$LSQLPASS $DB -s -N -e "SELECT orig from daily WHERE day='Monday' ORDER BY date desc LIMIT 10;")"
for EACHMON in $MON10
MONTOTAL=`expr $MONTOTAL + $EACHMON`;
echo "Total :" $MONTOTAL