conky/bin/conky_temp.sh

23 lines
304 B
Bash
Executable File

#!/bin/ksh
_count=0
_temp=0
sysctl hw.sensors | { while read _sensor _rest; do
case ${_sensor} in
*temp*)
_t=${_sensor##*=}
_t=${_t%%.*}
(( _count += 1 ))
(( _temp += ${_t} ))
;;
esac
done
[[ ${_count} -ne 0 ]] && print $(( _temp /= ${_count} ))
}