dotfiles/Executables/sys

39 lines
688 B
Bash
Executable file

#!/bin/sh
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
}
tput setaf 5
echo "$HOSTNAME"
echo "$(uname -sr)"
echo "$(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))"
raminfo=$(free --mega | head -n 2 | tail -n 1)
usedram=$(field 3 $raminfo)
totalram=$(field 2 $raminfo)
echo "$usedram/$totalram MB ($(($usedram*100/$totalram))%)"
tput setaf reset
show_colors 0 7
show_colors 8 15