update Disk information

This commit is contained in:
Teddysun 2016-11-27 16:37:14 +09:00
parent 95c2bab52a
commit b96f4dc697

View File

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