I wrote this code to get temperature in floating point in bash. this gives me an error:
line 16: [: missing ']'
Here is the code:
#!/bin/bash
echo "Celsius Fahrenheit"
echo "--------------------------"
counter=0
while [ $counter -le 25 ]:
do
let "val = ($counter * 9/5) + 32"
if [ $counter -le 9 ]
then
whitespace=" "
else
whitespace=" "
fi
echo "$counter$whitespace$val"
((counter++))
if [[ "$REPLY" =~ ^-?[[:digit:]]*\.[[:digit:]]+$ ]]; then
echo "'$REPLY' is a floating point number."
fi
done
exit 1