summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/redirect.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/bin/redirect.sh b/bin/redirect.sh
new file mode 100755
index 0000000..d309f1a
--- /dev/null
+++ b/bin/redirect.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+OUTFILE="/tmp/tmp_redirect_out"
+
+cmd="curl -v $1"
+`$cmd &> $OUTFILE`
+
+RES=`grep "< HTTP.*303" $OUTFILE`
+RES=${RES// /} # remove emtpy spaces
+
+#echo $RES
+
+if [ -z $RES ]; then
+ #echo "no"
+ echo ""
+else
+ #cat $OUTFILE
+ RES=`grep "< Location: " $OUTFILE`
+ RES=${RES//"< Location: "/} # remove lcoation spaces
+ echo $RES
+fi
+
+#match301=$(expr index "$res" 301)
+#
+#echo
+#echo "result:"
+#echo
+#cat $OUTFILE
+
+#echo $match301
+
+#for testing try 301 instead of 303 with google.de/www.google.de \ No newline at end of file