diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2015-10-22 11:10:15 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2015-10-22 11:10:15 +0300 |
commit | 23f86afeb3e044496788359a5cfd88976bbc0616 (patch) | |
tree | 5b271f813fb08c5e9d82669de950a1d508822ed6 /functions/power-utilities.zsh | |
parent | 5addfdc9e08b3be1a2377b7f0c28f17ce8b8a4ab (diff) | |
parent | e8771a7039d8cde54321c044a3a779c43783d144 (diff) |
Merge branch 'next' into color_detection
Diffstat (limited to 'functions/power-utilities.zsh')
-rw-r--r-- | functions/power-utilities.zsh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/functions/power-utilities.zsh b/functions/power-utilities.zsh index 370374aa..be0ffc86 100644 --- a/functions/power-utilities.zsh +++ b/functions/power-utilities.zsh @@ -92,9 +92,10 @@ function isSameColor() { # Converts large memory values into a human-readable unit (e.g., bytes --> GB) printSizeHumanReadable() { - local size=$1 + typeset -F 2 size + size="$1"+0.00001 local extension - extension=(B K M G T P E Z Y) + extension=('B' 'K' 'M' 'G' 'T' 'P' 'E' 'Z' 'Y') local index=1 # if the base is not Bytes @@ -107,7 +108,7 @@ printSizeHumanReadable() { done fi - while (( (size / 1024) > 0 )); do + while (( (size / 1024) > 0.1 )); do size=$(( size / 1024 )) index=$(( index + 1 )) done @@ -187,4 +188,3 @@ if [[ "$OS" == 'OSX' ]]; then SED_EXTENDED_REGEX_PARAMETER="-E" fi fi - |