#!/bin/sh
#
# Read sensor status information and copy it into a text file
#

# Check arguments
if [ $# -ne 3 ]
then
	echo "usage: $0 <sensor value> <chip name> <output file>" >&2
	exit 1
fi
item="$1"
chip="$2"
outfile="$3"

# Now read sensor status and write result into output file
/usr/bin/sensors "$chip" | \
sed "y///;/^$item[:]/s/^.*[:][ 	]\+[+-]\?\([^ 	]\+\).*$/\1/p;d" >/tmp/sensout.$$
mv /tmp/sensout.$$ $outfile

