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