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