aboutsummaryrefslogtreecommitdiffstats
path: root/squashfu
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2010-06-11 14:47:10 -0400
committerDave Reisner <d@falconindy.com>2010-06-11 15:03:08 -0400
commitbb961954d1da2d84daf3e6717f75d3d897c9115d (patch)
tree3b4f34b509222b3c782575babe0141e0c3cd199d /squashfu
parent0fbbe1fbf789988fbc50de992827e6af7afa231e (diff)
downloadsquashfu-bb961954d1da2d84daf3e6717f75d3d897c9115d.tar.gz
use PE instead of awk and get rid of some subshells
Diffstat (limited to 'squashfu')
-rwxr-xr-xsquashfu21
1 files changed, 8 insertions, 13 deletions
diff --git a/squashfu b/squashfu
index 7852038..1454681 100755
--- a/squashfu
+++ b/squashfu
@@ -307,33 +307,28 @@ action_rollback () {
action_report () {
info "SquashFu Usage Report"
- echo
# Enumerate bins, sort date order, print human readable create date and size
pushd "$BINS_DIR" &>/dev/null
- OIFS=$IFS;IFS=${IFS}$':'
# Collect all data into an array to 'preload' it. Index 0 is the entire
# folder. The following indicies correspond to the bin number of that index
- 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=${d#*[[:space:]]}
- local size=${d%[[:space:]]*}
+ printf "\n%30s\r" ".: Loading :." >&2
+
+ while read size bin; do
case ${bin} in
'total') total=$size; continue ;;
'.') DATA[0]=$size ;;
*) DATA[${bin}]=$size ;;
esac
- done
+ done < <(du -csh . * 2>/dev/null | sort -n -k2)
printf "%30s\r" "" >&2
printf "%10s\t%25s\t%7s\n" "Bin ID" "Date Created" "Size"
- grep -vE "^[\t ]*$" "$BINVENTORY" | sort -r -t: -k2 -n | while read bin stamp; do
- printf "%10d\t%25s\t%7s\n" "$bin" \
- "$(date --rfc-3339=seconds --date="@$stamp")" \
- "${DATA[$bin]}"
- done
+ OIFS=$IFS;IFS=${IFS}$':'
+ while read bin stamp; do
+ printf "%10d\t%25s\t%7s\n" "$bin" "$(date --rfc-3339=seconds --date="@$stamp")" "${DATA[$bin]}"
+ done < <(grep -v "^[[:space:]]*$" "$BINVENTORY" | sort -nr -t':' -k2)
IFS=$OIFS
printf "%10s\t%25s\t%7s\n" "" "Incremental Total" "${DATA[0]}"