Uconsole-i3/scripts/rpitemp.sh

11 lines
249 B
Bash
Raw Permalink Normal View History

2023-10-13 22:29:49 +02:00
#!/bin/bash
# Get the CPU temperature
cpu_temp_milli=$(cat /sys/class/thermal/thermal_zone0/temp)
# Convert to degrees Celsius
cpu_temp=$(awk -v temp="$cpu_temp_milli" 'BEGIN {printf "%.1f", temp/1000}')
# Output the temperature
echo "$cpu_temp"