Last active
August 29, 2015 14:16
-
-
Save wangchen/caee92b78268b8f4bf7a to your computer and use it in GitHub Desktop.
check the gzip on/off
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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