bash-util/scripts/pacpruner-calculator

16 lines
388 B
Bash
Executable file

#!/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"
kib_terms=$(cat "$1" | xargs du | awk '{print $1}' | tr $'\n' '+' | sed 's/+$//')
perl -e "print $kib_terms"' . "\n";'