diff --git a/stow/shell/dot-functions b/stow/shell/dot-functions index 07c5796d42c..1d885cf5f60 100644 --- a/stow/shell/dot-functions +++ b/stow/shell/dot-functions @@ -85,7 +85,10 @@ function server() { # Compare original and gzipped file size function gz() { local origsize gzipsize ratio - origsize=$(wc -c <"${1}") + origsize=$( + stat -Lf"%z" -- "$1" 2> /dev/null; # macOS `stat` + stat -Lc"%s" -- "$1" 2> /dev/null; # GNU `stat` + ); gzipsize=$(gzip -c "${1}" | wc -c) ratio=$(echo "${gzipsize} * 100 / ${origsize}" | bc -l) printf "orig: %d bytes\n" "${origsize}"