ArchLinux:Shell
From Wiki.cyring.fr
(Difference between revisions)
(→Bash script to read ASUS sensors) |
|||
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 () | ||
{ | { |
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 ;;
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
}