In exemple,
In a French system with a coma decimal separating sign, awk return number like this exemple : '31,0'
The bc command then return an error : '(standard_in) 1: syntax error'
a simple solution is to force the C local in 'get_avg_cpu_temperature' like this :
get_avg_cpu_temperature() {
temps=$(get_cpu_temperatures)
if [ -z "$temps" ]; then
echo ""
else
echo "$temps" | awk '{sum+=$1} END {if (NR>0) print sum/NR; else print ""}' | LC_ALL=C awk '{printf "%.1f", $0}'
fi
}
In exemple,
In a French system with a coma decimal separating sign, awk return number like this exemple : '31,0'
The bc command then return an error : '(standard_in) 1: syntax error'
a simple solution is to force the C local in 'get_avg_cpu_temperature' like this :
get_avg_cpu_temperature() {
temps=$(get_cpu_temperatures)
if [ -z "$temps" ]; then
echo ""
else
echo "$temps" | awk '{sum+=$1} END {if (NR>0) print sum/NR; else print ""}' | LC_ALL=C awk '{printf "%.1f", $0}'
fi
}