View Single Post
Posts: 805 | Thanked: 1,605 times | Joined on Feb 2010 @ Gdynia, Poland
#154
Originally Posted by cipper View Post
i think that
TEMP=$(( $TEMP / 10 ))
is the right one
Yes, but both are correct (there is no 'right' one in the meaning that only one works). When you use $(( expression )) you don't need to add '$' in front of variables in expression. If you don't believe me, try running:
Code:
FILE_TEMP=`cat /sys/class/power_supply/bq27200-0/temp`
echo "Temp got from file: " $FILE_TEMP
MISIAK_TEMP=$((FILE_TEMP/10))
echo "Misiak way: " $MISIAK_TEMP
CIPPER_TEMP=$(($FILE_TEMP/10))
echo "Cipper way: " $CIPPER_TEMP
The result is the same
 

The Following User Says Thank You to misiak For This Useful Post: