ArchLinux:Shell
From Wiki.cyring.fr
(Difference between revisions)
Cyril (Talk | contribs)
(Created page with "===== Bash script to read ASUS sensors ===== <br /> http://blog.cyring.fr/wp-content/uploads/2010/10/Sensors.png <br /><br /> <syntaxhighlight lang="bash"> $ nano ~/.bashrc </...")
Newer edit →
(Created page with "===== Bash script to read ASUS sensors ===== <br /> http://blog.cyring.fr/wp-content/uploads/2010/10/Sensors.png <br /><br /> <syntaxhighlight lang="bash"> $ nano ~/.bashrc </...")
Newer edit →
Revision as of 14:44, 6 April 2012
Bash script to read ASUS sensors
$ nano ~/.bashrc
function chipset ()
{
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 /sys/class/hwmon/hwmon1/${Dev}${I}_label ];
do
local Label=$(cat /sys/class/hwmon/hwmon1/${Dev}${I}_label)
local Input=$(cat /sys/class/hwmon/hwmon1/${Dev}${I}_input)
local Min=$(cat /sys/class/hwmon/hwmon1/${Dev}${I}_${Label1})
local Max=$(cat /sys/class/hwmon/hwmon1/${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
}