diff options
Diffstat (limited to '.functions')
-rw-r--r-- | .functions | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -52,12 +52,13 @@ function phpserver() { php -S "${ip}:${port}" } -# Get gzipped file size +# Compare original and gzipped file size function gz() { - echo "orig size (bytes): " - cat "$1" | wc -c - echo "gzipped size (bytes): " - gzip -c "$1" | wc -c + local origsize=$(wc -c < "$1") + local gzipsize=$(gzip -c "$1" | wc -c) + local ratio=$(echo "$gzipsize * 100/ $origsize" | bc -l) + printf "orig: %d bytes\n" "$origsize" + printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio" } # Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL. |