Merge pull request #146 from iandrewt/disk_display_fix

fixed output of disk bar when gigabytes are used of a terabyte disk
This commit is contained in:
Dylan Araps 2016-03-14 21:43:45 +11:00
commit f17220c04a
1 changed files with 9 additions and 5 deletions

View File

@ -1505,14 +1505,18 @@ getdisk () {
# Add info bar # Add info bar
disk_used=${disk_used/G} disk_used=${disk_used/G}
disk_used=${disk_used/T}
disk_total=${disk_total/G} disk_total=${disk_total/G}
disk_total=${disk_total/T}
[[ "$disk_used" == *"T" ]] && \
disk_used=$(printf "%s\n" "${disk_used/T} * 1000" | bc)
[[ "$disk_total" == *"T" ]] && \
disk_total=$(printf "%s\n" "${disk_total/T} * 1000" | bc)
case "$disk_display" in case "$disk_display" in
"bar") disk="$(bar "${disk_used/'.'}" "${disk_total/'.'}")" ;; "bar") disk="$(bar "${disk_used/'.'*}" "${disk_total/'.'*}")" ;;
"infobar") disk+=" $(bar "${disk_used/'.'}" "${disk_total/'.'}")" ;; "infobar") disk+=" $(bar "${disk_used/'.'*}" "${disk_total/'.'*}")" ;;
"barinfo") disk="$(bar "${disk_used/'.'}" "${disk_total/'.'}") $disk" ;; "barinfo") disk="$(bar "${disk_used/'.'*}" "${disk_total/'.'*}") $disk" ;;
esac esac
} }