I want to write a script to pick one of 2 vpn connections, I might add more but I need to get over my first hurdle which is why I'm pasting here.
As long as the connection is above 100 as calculated by the wget statement in line 3 all is good.
But if it drops to below 100 I get a message
./vpngood.sh: line 6: [: 81.2: integer expression expected
-------------------------------------------------------
#!/bin/bash
#My name is vpngood.sh
#set -x
AVERAGE=`wget -O /dev/null
http://somewebsite.jpg 2>&1 | grep '\([0-9.]\+ [KM]B>
if [ $AVERAGE -gt 100 ]
then
echo "Average is above 100"
else
echo "Count is below than 100"
fi
-------------------------------------------------------
If I manually set Average to a number it works fine.
What am I doing wrong?
Thanks