Skip to content

Instantly share code, notes, and snippets.

@umer936
Created July 20, 2017 23:38
Show Gist options
  • Save umer936/99b17cc9e682f00fced247b7a5f40955 to your computer and use it in GitHub Desktop.
Save umer936/99b17cc9e682f00fced247b7a5f40955 to your computer and use it in GitHub Desktop.
Shows temperature of CPU in C and F
#!/bin/bash
while [ 1 ]
do
cpu_temp=$(< /sys/class/thermal/thermal_zone0/temp)
cpu_temp=$(($cpu_temp))
ceclis=$(echo "scale=1; $cpu_temp / 1000" | bc | tr '\n' ' ')
echo "$ceclis °C" | tr '\n' ' '
echo " | " | tr '\n' ' '
echo "scale=2; ( $cpu_temp / 1000 ) * 9 / 5 + 32" | bc | tr '\n' ' '
echo "˚F"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment