1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/usr/bin/env sh total_temp=0 i=0 for temp_file in /sys/class/hwmon/hwmon*/temp*_input do temp="$(cat "${temp_file}")" if [ "${temp}" != "0" ] then total_temp="$(( ${total_temp} + ${temp} ))" i="$(( ${i} + 1 ))" fi done echo -n "$(( ${total_temp} / ${i} / 1000 ))" °C