*Disclaimer, I'm absolutely positive that there is a better way to do this, but it works, and does what I need ... for now.*
This is the script I'm using. Name it whatever.
Code: Select all
#! /bin/bash
temp() {
tempstat=$(cat /sys/class/thermal/thermal_zone0/temp | awk '{print $1/1000}')
echo "$tempstat"
}
cpu() {
cpustat=$(top -bn 2 -d 0.01 | grep '^%Cpu' | tail -n 1 | awk '{print $2+$4+$6}')
echo "$cpustat"
}
mem() {
memstat=$(free -m | grep buffers/cache | sed -e 's/[buffers/cache -+ :]//g' | sed 's/.\{4\}$//')
echo "$memstat"
}
clock() {
clockstat=$(date | sed -e 's/EST 2014//g')
echo "$clockstat"
}
batt() {
battstat=$(cat /sys/class/power_supply/BAT0/capacity)
echo "$battstat"
}
mail() {
mailstat=$($HOME/mail)
echo "$mailstat"
}
music() {
musicstat=$($HOME/music)
echo "$musicstat"
}
vol() {
volstat=$(amixer get Master | tail -1 | sed 's/.*\[\([0-9]*%\)\].*/\1/')
echo "$volstat"
}
#OUTPUT=
while true; do
echo " \f5m$(mail) b$(batt) r$(mem) c$(cpu) t$(temp) v$(vol) \c\f9$(clock) \r\f9$(music) "
sleep 10s;
done
Code: Select all
/path/to/script | bar -p &
http://postimg.org/image/sixymv9tr/