ArchLinux:Shell
From Wiki.cyring.fr
Bash script to read ASUS sensors
$ nano ~/.bashrc
function chipset ()
{
local hwpath="/sys/class/hwmon/hwmon2"
local Dev="all"
case "${1}" in
( fan | FAN )
Label1="min"
Label2="max"
Dev="fan" ;;
( temp | temperature | TEMP | TEMPERATURE )
Label1="max"
Label2="crit"
Dev="temp" ;;
( volt | voltage | VOLT | VOLTAGE )
Label1="min"
Label2="max"
Dev="in" ;;
( * )
echo "Usage: $FUNCNAME [FAN] [TEMP] [VOLT]"
return 1 ;;
esac
declare -i I=1
while [ -e ${hwpath}/${Dev}${I}_label ];
do
local Label=$(cat ${hwpath}/${Dev}${I}_label)
local Input=$(cat ${hwpath}/${Dev}${I}_input)
local Min=$(cat ${hwpath}/${Dev}${I}_${Label1})
local Max=$(cat ${hwpath}/${Dev}${I}_${Label2})
local Padding=""
declare -i Len=${#Label}
for (( L=${Len}; L<32; L++ ));
do
Padding=${Padding}" "
done
echo -e "${Label}${Padding}${Input}\t[ ${Min} - ${Max} ]";
I=I+1
done
}