update get disk size

fixed a bug

Signed-off-by: Teddysun <i@teddysun.com>
This commit is contained in:
Teddysun 2017-05-26 23:41:36 +09:00
parent a23643e064
commit bc7720d15b
No known key found for this signature in database
GPG Key ID: 09BD4C080AD6C46D

View File

@ -81,6 +81,7 @@ calc_disk() {
for size in ${array[@]} for size in ${array[@]}
do do
[ "${size}" == "0" ] && size_t=0 || size_t=`echo ${size:0:${#size}-1}` [ "${size}" == "0" ] && size_t=0 || size_t=`echo ${size:0:${#size}-1}`
[ "`echo ${size:(-1)}`" == "K" ] && size=0
[ "`echo ${size:(-1)}`" == "M" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' / 1024}' ) [ "`echo ${size:(-1)}`" == "M" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' / 1024}' )
[ "`echo ${size:(-1)}`" == "T" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' * 1024}' ) [ "`echo ${size:(-1)}`" == "T" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' * 1024}' )
[ "`echo ${size:(-1)}`" == "G" ] && size=${size_t} [ "`echo ${size:(-1)}`" == "G" ] && size=${size_t}