Files
webthink/addJavaScriptHash.sh

12 lines
348 B
Bash
Raw Permalink Normal View History

2017-02-07 20:13:14 +00:00
#!/bin/bash
# Script adds a MD5-Hash as a get-parameter to all javascript-sourced-files in order to get around
# delivery of old content from caches.
md5sum *.js | while read l;
do md5=$(echo $l|cut -d " " -f 1)
filename=$(echo $l|cut -d " " -f 2)
sed -e "s/src=\"${filename}\"/src=\"${filename}?md5=${md5}\"/g" $1 > tmp.$$
mv tmp.$$ $1
done