2017-09-20 17:23:24 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-01-08 14:47:04 +01:00
|
|
|
intelTemp=$(
|
|
|
|
sensors | # execute sensors
|
|
|
|
grep -w "Core 0:" | # grep for the first core
|
|
|
|
sed 's/([^)]*)//g' | # filter
|
|
|
|
tr -s " " | # remove whitespace
|
|
|
|
sed -e 's/Core 0\(.*\):/\1/' | # get value between Core 0 and :
|
|
|
|
cut -c 3- | rev | cut -c 7- | rev #remove clutter
|
2017-09-20 17:23:24 +02:00
|
|
|
)
|
|
|
|
|
2023-01-08 14:47:04 +01:00
|
|
|
amdTemp=$(sensors | grep -iw "tctl:" | sed 's/([^)]*)//g' | tr -s " " | cut -c 8- | rev | cut -c 2- | rev)
|
2020-02-15 12:50:20 +01:00
|
|
|
|
2017-09-20 17:23:24 +02:00
|
|
|
# echo out the result
|
2023-01-08 14:47:04 +01:00
|
|
|
if [ -z "$intelTemp" ]; then
|
2020-02-15 12:50:20 +01:00
|
|
|
echo $amdTemp
|
|
|
|
else
|
|
|
|
echo $intelTemp°C
|
|
|
|
fi
|