summaryrefslogtreecommitdiff
path: root/.local/bin/stemp
blob: 26a1168c66af07850b50269e92ffab55e0c63031 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
# stemp - print system/sensor temperature
# $1: sensor name(s) (optional)

for f in /sys/class/hwmon/hwmon*; do
	paste "$f/name" "$f/temp1_input" 2>/dev/null
done | if [ -z "$1" ]; then
	awk '{printf "%s\t%i°C\n",$1,$2/1000}'
else
	awk -v n="$*" 'BEGIN {gsub(" ","|",n)} \
		$1~n {printf "%i°C ",$2/1000} END {printf "\n"}'
fi