my-scripts/CoreTemp.sh

26 lines
661 B
Bash
Executable file

#!/bin/bash
# Read Core temperature for different CPUs (Intel and AMD)
#
# (c) GPL by Ulf Bartholomäus ub1x@gmx.net
VERSION="$( basename $0 ) Version 0.1.1 from 19.04.2022"
#
# Input: n/a
# Output: temperatur
# Returnvalue: n/a
#
#
# Changes:
# 0.1.1: initial version
mySensors=$(sensors)
#amd old
if [ "${mySensors/k10}" != "${mySensors}" ] ; then
sensors | sed -nE 's/^Tdie: *([^ ]*)/{\1}/p'
#amd new
elif [ "${mySensors/Tctl}" != "${mySensors}" ] ; then
sensors | sed -nE 's/^Tctl: *([^ ]*)/\1/p'
#intel
elif [ "${mySensors/core}" != "${mySensors}" ]] ; then
sensors | sed -ne 's/^Core*//p' | sed 's/°C.*/°C/' | sed 's/.*+/+/'
fi