Skip to content

Instantly share code, notes, and snippets.

@hampusn
Created June 4, 2016 23:58
Show Gist options
  • Save hampusn/dc3efb4736d07bdc58ffbccd122de7f3 to your computer and use it in GitHub Desktop.
Save hampusn/dc3efb4736d07bdc58ffbccd122de7f3 to your computer and use it in GitHub Desktop.
Bash-script to get the current SiteVision version for a URL
#!/usr/bin/env bash
####################################################
# Script to get the SiteVision version of a URL.
# This depends on the linked assets having the
# version number in their URLs.
####################################################
if [ -z "$1" ]; then
echo "Missing argument (URL)"
exit 1
fi
URL=$1
RESULT=$(curl -m 10 --retry 3 -L --max-redirs 3 -s $URL | sed -nE 's/.*\/sitevision\/([0-9\.\-]+)\/.*/\1/p' | sed 1q)
if [ -n "$RESULT" ]; then
echo "SiteVision $RESULT"
else
echo "Not running SiteVision"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment