update Disk size (round float number)

This commit is contained in:
Teddysun 2016-11-25 11:33:45 +09:00 committed by GitHub
parent 3495a4caa5
commit 29da548407

View File

@ -90,8 +90,8 @@ 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)}`" == "M" ] && size=$( awk 'BEGIN{print '$size_t' / 1024}' ) || size=${size_t} [ "`echo ${size:(-1)}`" == "M" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' / 1024}' ) || size=${size_t}
total_size=$( awk 'BEGIN{print '$total_size' + '$size'}' ) total_size=$( awk 'BEGIN{printf "%.1f", '$total_size' + '$size'}' )
done done
echo ${total_size} echo ${total_size}
} }