diff options
author | Dave Reisner <d@falconindy.com> | 2010-06-11 14:43:39 -0400 |
---|---|---|
committer | Dave Reisner <d@falconindy.com> | 2010-06-11 14:43:39 -0400 |
commit | 0fbbe1fbf789988fbc50de992827e6af7afa231e (patch) | |
tree | 5618b397992d45ab237ebcd24e5ef82286ac8eff /squashfu | |
parent | 977cf7902de607f612cd86c6707eb52aa5759cb1 (diff) | |
download | squashfu-0fbbe1fbf789988fbc50de992827e6af7afa231e.tar.gz |
du uses tabs as column separators, not spaces! go go parameter expansion
Diffstat (limited to 'squashfu')
-rwxr-xr-x | squashfu | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -317,11 +317,12 @@ action_report () { printf "%30s\r" ".: Loading :." >&2 IFS=$'\n' read -r -d $'\0' -a data < <(du -csh . * 2>/dev/null | sort -n -k2) for d in "${data[@]}"; do - local bin=($(awk '{ print $2,$1 }' <<< $d)) - case ${bin[0]} in - 'total') total=${bin[1]}; continue ;; - '.') DATA[0]=${bin[1]} ;; - *) DATA[${bin[0]}]=${bin[1]} ;; + local bin=${d#*[[:space:]]} + local size=${d%[[:space:]]*} + case ${bin} in + 'total') total=$size; continue ;; + '.') DATA[0]=$size ;; + *) DATA[${bin}]=$size ;; esac done |