There are many duplicate questions/examples on doing a comparison of variables in BASH, but none seem to work for me.
Code logic: Derive the (average) value of ping_val by executing a command:
ping_val=`ping -c 4 8.8.8.8| tail -1| awk '{print $4}' | cut -d '/' -f 2`
Then, if the value is less than 20, decrement another variable by 20:
if [ $ping_val -lt 20 ] #line 30
then
$tot_health = $tot_health - 20
fi
Here is my output: ./my-report.sh: line 30: [: 65.464: integer expression expected
Note: The value of ping_val has been verified because I through the raw number up later in a chart.