View Single Post
Posts: 8 | Thanked: 7 times | Joined on Jul 2008
#13
Here's an updated version that outputs both F and C:

Code:
#!/bin/sh

t=`cat /sys/devices/platform/i2c_omap.1/i2c-1/1-0048/temp1_input 2>/dev/null`
if [ "$t" = "" ]
then
  echo "No temperature sensor detected" > /dev/stderr
  exit 1
else
  c=`echo $t | sed -e 's/\(.*\)\(..\).$/\1\.\2C/'`
  f=`expr $t \* 9 / 5 + 32000 | sed -e 's/\(.*\)\(..\).$/\1\.\2F/'`
  echo $c $f
fi
 

The Following 6 Users Say Thank You to nygren For This Useful Post: