#!/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 ]] && printf "%2.2s" $(( _temp /= ${_count} )) }