Skip to content

Instantly share code, notes, and snippets.

@wangchen
Last active August 29, 2015 14:16
Show Gist options
  • Save wangchen/caee92b78268b8f4bf7a to your computer and use it in GitHub Desktop.
Save wangchen/caee92b78268b8f4bf7a to your computer and use it in GitHub Desktop.
check the gzip on/off
#!/bin/sh
if [ "$#" -lt 1 ]; then
echo "Usage: check_gzip <url>"
fi
b=$(curl "$1" --silent --write-out "%{size_download}\n" --output /dev/null)
a=$(curl "$1" --silent -H "Accept-Encoding: gzip,deflate" --write-out "%{size_download}\n" --output /dev/null)
if [ "$a" > "$b" ]; then
exit 0
else
exit -1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment