Not understanding bash script
by stockton from LinuxQuestions.org on (#6JM9P)
With the following bash script I get error message "./GetGridVoltage.sh: line 3: [: 0.0: integer expression expected"
Code:voltage=$( mosquitto_sub -h 192.168.8.119 -p 1883 -v -t '#' -C 15 | grep grid_voltage | awk 'NF>1{print $2}' )
gpio mode 6 output
if [ $voltage -gt 200 ]
then
gpio write 6 1
else
gpio write 6 0
fi
gpio mode 6 inputPlease tell me how to fix my error.
Code:voltage=$( mosquitto_sub -h 192.168.8.119 -p 1883 -v -t '#' -C 15 | grep grid_voltage | awk 'NF>1{print $2}' )
gpio mode 6 output
if [ $voltage -gt 200 ]
then
gpio write 6 1
else
gpio write 6 0
fi
gpio mode 6 inputPlease tell me how to fix my error.