Skip to content

Instantly share code, notes, and snippets.

@hampusn
Created June 4, 2016 23:58

Revisions

  1. hampusn created this gist Jun 4, 2016.
    22 changes: 22 additions & 0 deletions svv
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/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