mirror of
https://github.com/agresdominik/dotfiles.git
synced 2026-04-21 10:01:58 +00:00
24 lines
433 B
Bash
Executable File
24 lines
433 B
Bash
Executable File
#!/bin/sh
|
|
|
|
used=$(free -h --si | awk '/^Mem/ {print $3}')
|
|
total=$(free -h --si | awk '/^Mem/ {print $2}')
|
|
|
|
text="${used}/${total}"
|
|
|
|
echo "$text"
|
|
echo "$text"
|
|
|
|
u=$(free --si | awk '/^Mem/ {print $3}')
|
|
t=$(free --si | awk '/^Mem/ {print $2}')
|
|
|
|
u_num=${u%[A-Za-z]*}
|
|
t_num=${t%[A-Za-z]*}
|
|
|
|
pct=$(awk -v u="$u_num" -v t="$t_num" 'BEGIN {printf "%.0f", (u/t)*100}')
|
|
|
|
if [ "$pct" -ge 90 ]; then
|
|
echo "#ffcc66"
|
|
else
|
|
echo "#ffffff"
|
|
fi
|