bash-util/scripts/pacpruner-calculator

17 lines
388 B
Text
Raw Permalink Normal View History

#!/usr/bin/env bash
read -d '' usage <<EOUSAGE
This script calculates the amount of space (in kibibytes) taken by the files
referenced in a newline-delimited listing.
USAGE: $0 FILE_LIST
EOUSAGE
. "$(dirname $0)/util/logging.bash"
[ -z "$1" ] && dedcat "$usage"
2023-06-24 04:07:07 -05:00
kib_terms=$(cat "$1" | xargs du | awk '{print $1}' | tr $'\n' '+' | sed 's/+$//')
2023-06-24 04:07:07 -05:00
perl -e "print $kib_terms"' . "\n";'