#!/bin/bash if command -v sensors &> /dev/null; then raw_temp=$(sensors | grep -m1 -E 'Package id 0|Tdie|Tctl|Core 0' | grep -oP '\+?\d+(\.\d+)?(?=°C)') if [[ -n "$raw_temp" ]]; then # Удалим "+" и округлим clean_temp=$(echo "$raw_temp" | sed 's/+//' | awk '{printf("%d\n", $1)}') echo "$clean_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