2025-06-22 21:18:32 +03:00

19 lines
403 B
Bash
Executable File

#!/bin/bash
if command -v sensors &> /dev/null; then
temp=$(sensors | grep -m1 -E 'Package id 0|Tdie|Tctl|Core 0' | grep -oP '\+?\d+(\.\d+)?(?=°C)')
if [[ -n "$temp" ]]; then
echo "$temp"
exit 0
fi
fi
if [[ -f /sys/class/thermal/thermal_zone0/temp ]]; then
temp=$(cat /sys/class/thermal/thermal_zone0/temp)
echo "$((temp / 1000))"
exit 0
fi
echo "N/A"
exit 1