Skip to content

Instantly share code, notes, and snippets.

@swooningfish
Forked from dweeber/gist:3748975
Created February 9, 2013 16:24
Show Gist options
  • Save swooningfish/4745890 to your computer and use it in GitHub Desktop.
Save swooningfish/4745890 to your computer and use it in GitHub Desktop.
#!/bin/bash
######################################################################
# Raspberry Pi
#
# Gross Script by Dweeber (Kevin Reed) <[email protected]>
# V1.0 2012-09-19
#
# Use the vcgencmd to obtain the Temp of the SOC
# then calculates the F value using bc.
#
# Requires bc to be loaded. If not then
# apt-get install bc
#
######################################################################
tm=`/opt/vc/bin/vcgencmd measure_temp`
tc=`echo $tm| cut -d '=' -f2 | sed 's/..$//'`
tf=$(echo "scale=2;((9/5) * $tc) + 32" |bc)
echo temp = $tf\'F \($tc\'C\)
@swooningfish
Copy link
Author

or with one command

awk '{printf("%.1f\n",$1/1e3)}' /sys/class/thermal/thermal_zone0/temp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment