Update system info script

This commit is contained in:
Lavender 2021-04-28 15:39:06 -07:00
parent 72a59e91ce
commit 8e5ad6f070
Signed by: endie
GPG key ID: CC5162D7C2146F01

View file

@ -1,5 +1,13 @@
#!/bin/sh
display() {
tput setaf 3
echo -n $1
echo -n " "
tput setaf 5
echo $2
}
field() {
num=$1
shift
@ -16,22 +24,21 @@ show_colors() {
echo
}
tput setaf 5
echo " $HOSTNAME"
echo " $(uname -sr)"
echo " $(yay -Qq | wc -l)"
display " " "$HOSTNAME"
display " " "$(uname -sr)"
display " " "$(yay -Qq | wc -l)"
diskinfo=$(df -h / | tail -n 1)
useddisk=$(field 3 $diskinfo)
totaldisk=$(field 2 $diskinfo)
echo " ${useddisk::-1}/${totaldisk::-1} GB ($(field 5 $diskinfo))"
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)
echo " $usedram/$totalram MB ($(($usedram*100/$totalram))%)"
display " " "$usedram/$totalram MB ($(($usedram*100/$totalram))%)"
tput setaf reset