mirror of
https://github.com/agresdominik/dotfiles.git
synced 2026-04-21 18:05:50 +00:00
Update to dotfiles
This commit is contained in:
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user