dotfiles/Executables/sys

47 lines
797 B
Text
Raw Permalink Normal View History

#!/bin/sh
2021-04-28 22:39:06 +00:00
display() {
tput setaf 3
echo -n $1
echo -n " "
tput setaf 5
echo $2
}
field() {
num=$1
shift
echo $@ | cut -d ' ' -f $num
}
show_colors() {
for i in $(seq $1 $2)
do
tput setab $i
echo -n " "
done
tput setab reset
echo
}
2021-04-28 22:39:06 +00:00
display " " "$HOSTNAME"
display " " "$(uname -sr)"
display " " "$(yay -Qq | wc -l)"
diskinfo=$(df -h / | tail -n 1)
useddisk=$(field 3 $diskinfo)
totaldisk=$(field 2 $diskinfo)
2021-04-28 22:39:06 +00:00
display " " "${useddisk::-1}/${totaldisk::-1} GB ($(field 5 $diskinfo))"
raminfo=$(free --mega | head -n 2 | tail -n 1)
usedram=$(field 3 $raminfo)
totalram=$(field 2 $raminfo)
2021-04-28 22:39:06 +00:00
display " " "$usedram/$totalram MB ($(($usedram*100/$totalram))%)"
tput setaf reset
show_colors 0 7
show_colors 8 15