2021-04-27 20:31:56 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-04-28 22:39:06 +00:00
|
|
|
display() {
|
|
|
|
tput setaf 3
|
|
|
|
echo -n $1
|
|
|
|
echo -n " "
|
|
|
|
tput setaf 5
|
|
|
|
echo $2
|
|
|
|
}
|
|
|
|
|
2021-04-27 20:31:56 +00:00
|
|
|
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)"
|
2021-04-27 20:31:56 +00:00
|
|
|
|
|
|
|
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))"
|
2021-04-27 20:31:56 +00:00
|
|
|
|
|
|
|
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))%)"
|
2021-04-27 20:31:56 +00:00
|
|
|
|
|
|
|
tput setaf reset
|
|
|
|
|
|
|
|
show_colors 0 7
|
|
|
|
show_colors 8 15
|