diff options
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/cpt-size | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/contrib/cpt-size b/contrib/cpt-size index 456fa25..f55f72a 100755 --- a/contrib/cpt-size +++ b/contrib/cpt-size @@ -11,12 +11,14 @@ esac cpt-search "$1" >/dev/null -# Filter directories from manifest and leave only files. -# Directories in the manifest end in a trailing '/'. -files=$(sed 's|.*/$||' "$CPT_ROOT/var/db/cpt/installed/$1/manifest") +files= +while read -r file; do + # Filter directories from manifest and leave only files. + # Directories in the manifest end in a trailing '/'. + case $file in */) continue; esac + files="$files '$file'" +done < "$CPT_ROOT/var/db/cpt/installed/$1/manifest" +eval "set -- $files" # Send the file list to 'du'. -# This unquoted variable is safe as word splitting is intended -# and globbing is globally disabled in this script. -# shellcheck disable=2086 -du -shc -- $files 2>/dev/null +du -shc -- "$@" 2>/dev/null |