Source Code of: confirmRedirects.sh
Date Last Modified: May 10, 2011 - 11:48:55 PM
Size: 846 Bytes |
31 lines | 846 characters
#!/bin/bash
######################################################################### # # First parameter is the URL to check # Second parameter is the URL the first URL ought to redirect to # # Example: assert_redirect http://foo.com/bar.html http://foo.com/bar/index.html # would verify that the first argument redirects to the second. # ######################################################################### assert_redirect () { output=$(curl --head $1 2>/dev/null | grep '^Location:' | cut -d\ -f2-) report_result "${output//$'\r'}" $2 }
report_result () { if [ "$1" == "$2" ] then echo "GOOD" else echo "FAIL... currently redirecting to $1 and should redirect to $2" fi }
assert_redirect http://www.balancedinsight.com/beta http://www.balancedinsight.com/beta-software-download1
|
A Derivative Work of: PHP Source Code Utility - Version 1.0.0 Copyright ©
0php.com 2002.