Created
July 18, 2016 15:04
-
-
Save elico/ac58073812b8cad14ef154d8730e22cb to your computer and use it in GitHub Desktop.
Add CDN HIT notation
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
#!/usr/bin/env bash | |
HEADERSDIR=/opt/dir/ | |
function add() { | |
grep -H "X-SHMSCDN: HIT" $1 || perl -pi -e '$/="";s/\r\n\r\n/\r\nX-SHMSCDN: HIT\r\n\r\n/;' $1 | |
} | |
if [ "$1" = "-add" ]; then | |
shift 1 | |
add "$@" | |
exit $? | |
fi | |
ls $HEADERSDIR |xargs -l1 $SHELL "$0" -add |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment