#!/bin/bash -l
# sensors watch

while [ -d /sys/bus/i2c/devices -o -d /sys/bus/acpi/drivers/thermal -o -d /sys/class/hwmon ] ; do
	clear
	DO_SENSORS=0
	if [ -d /sys/bus/i2c/devices ] ; then
		if [ -n "`ls -1A /sys/bus/i2c/devices/`" ] ; then
			DO_SENSORS=1
		fi
	fi
	if [ -d /sys/class/hwmon ] ; then
		if [ -n "`ls -1A /sys/class/hwmon/`" ]; then
			DO_SENSORS=1
		fi
	fi
	if [ -d /sys/bus/acpi/drivers/thermal ] ; then
		if [ -n "`ls -1A /sys/bus/acpi/drivers/thermal/ | grep -i THERM`" ] ; then
			DO_SENSORS=1
		fi
	fi
	if [ "${DO_SENSORS}" -eq 1 ] ; then
		sensors | grep -v -E '(^$|^Adapter:)'
	fi
	sleep 2
done
