ArchLinux:Shell
From Wiki.cyring.fr
(Difference between revisions)
(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 </...") |
(→Bash script to read ASUS sensors) |
||
| (One intermediate revision not shown) | |||
| Line 7: | Line 7: | ||
</syntaxhighlight><br /> | </syntaxhighlight><br /> | ||
<syntaxhighlight lang="bash" line start="1"> | <syntaxhighlight lang="bash" line start="1"> | ||
| + | export EDITOR=nano | ||
| + | |||
| + | alias p='ps -eo user:5,pid:6,pcpu:5,rss:7,nlwp:2,comm --sort +pcpu,+rss' | ||
| + | |||
function chipset () | function chipset () | ||
{ | { | ||
| + | local hwpath="/sys/class/hwmon/hwmon2" | ||
| + | |||
local Dev="all" | local Dev="all" | ||
case "${1}" in | case "${1}" in | ||
| Line 29: | Line 35: | ||
declare -i I=1 | declare -i I=1 | ||
| - | while [ -e | + | while [ -e ${hwpath}/${Dev}${I}_label ]; |
do | do | ||
| - | local Label=$(cat | + | local Label=$(cat ${hwpath}/${Dev}${I}_label) |
| - | local Input=$(cat | + | local Input=$(cat ${hwpath}/${Dev}${I}_input) |
| - | local Min=$(cat | + | local Min=$(cat ${hwpath}/${Dev}${I}_${Label1}) |
| - | local Max=$(cat | + | local Max=$(cat ${hwpath}/${Dev}${I}_${Label2}) |
local Padding="" | local Padding="" | ||
Latest revision as of 11:56, 24 December 2013
Bash script to read ASUS sensors
$ nano ~/.bashrc
export EDITOR=nano
alias p='ps -eo user:5,pid:6,pcpu:5,rss:7,nlwp:2,comm --sort +pcpu,+rss'
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 ;;
esacdeclare -i I=1
while [ -e ${hwpath}/${Dev}${I}_label ];
dolocal 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++ ));
doPadding=${Padding}" "
doneecho -e "${Label}${Padding}${Input}\t[ ${Min} - ${Max} ]";
I=I+1
done}