s4

changeset 164:0cc22764899e

size_h returns more recognizable unit
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 22 Jan 2016 18:41:52 +0859
parents 87e679d3c993
children 4040bb8b2038
files s4-funcs.sh
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/s4-funcs.sh	Tue Jan 19 10:23:05 2016 +0859
     1.2 +++ b/s4-funcs.sh	Fri Jan 22 18:41:52 2016 +0859
     1.3 @@ -756,13 +756,13 @@
     1.4    cat "$@" | $enascii
     1.5  }
     1.6  size_h() {
     1.7 -  i="$1"
     1.8 -  set -- B KB MM GB TB
     1.9 -  while [ $((i)) -gt 0 -a -n "$1" ]; do
    1.10 +  i="$1" oi=$1
    1.11 +  set -- B B KB MB GB TB
    1.12 +  while [ $((i)) -gt 9 -a -n "$1" ]; do	# -gt 9 means $oi > 1024
    1.13      oi=$i
    1.14      i=$((i/1024))
    1.15 +    shift
    1.16    done
    1.17 -  shift
    1.18    echo ${oi}$1
    1.19  }
    1.20  gettblconf() {