Revert to original.

This commit is contained in:
Max Drasbeck 2020-09-12 07:25:48 +02:00 committed by GitHub
parent b2d99517d0
commit 8effb120dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,21 +16,16 @@ get_percent()
{ {
case $(uname -s) in case $(uname -s) in
Linux) Linux)
# percent=$(free -m | awk 'NR==2{printf "%.1f%%\n", $3*100/$2}') # percent=$(free -m | awk 'NR==2{printf "%.1f%%\n", $3*100/$2}')
total_mem_gb=$(free -g | awk '/^Mem/ {print $2}') used_mem=$(free -g | awk '/^Mem/ {print $3}')
used_mem=$(free -g | awk '/^Mem/ {print $3}') total_mem=$(free -h | awk '/^Mem/ {print $2}')
total_mem=$(free -h | awk '/^Mem/ {print $2}') if (( $used_mem == 0 )); then
if (( $total_mem_gb == 0)); then memory_usage=$(free -m | awk '/^Mem/ {print $3}')
memory_usage=$(free -m | awk '/^Mem/ {print $3}') echo $memory_usage\M\B/$total_mem\G\B
total_mem_mb=$(free -m | awk '/^Mem/ {print $2}') else
echo $memory_usage\M\B/$total_mem_mb\M\B memory_usage=$(free -g | awk '/^Mem/ {print $3}')
elif (( $used_mem == 0 )); then echo $memory_usage\G\B/$total_mem\G\B
memory_usage=$(free -m | awk '/^Mem/ {print $3}') fi
echo $memory_usage\M\B/$total_mem\G\B
else
memory_usage=$(free -g | awk '/^Mem/ {print $3}')
echo $memory_usage\G\B/$total_mem\G\B
fi
;; ;;
Darwin) Darwin)