summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xhead.bash8
1 files changed, 6 insertions, 2 deletions
diff --git a/head.bash b/head.bash
index aa27d80..9b0881d 100755
--- a/head.bash
+++ b/head.bash
@@ -18,7 +18,7 @@ argrest=`echo "$url" | cut -d\ -f1 --complement`
if [[ $arg1 = "--version" ]]
then
- echo "Blatech head v0.2.2"
+ echo "Blatech head v0.3"
exit
elif [[ $arg1 = "-h" || $arg1 = "--help" ]]
then
@@ -36,10 +36,14 @@ sed -i ':a;N;$!ba;s/\r//g' head.txt
http=`grep HTTP head.txt`
modified=`grep Last-Modified head.txt | sed "s/Last-Modified: //"`
type=`grep Content-Type head.txt | cut -d " " -f2`
+location=`grep Location head.txt | cut -d " " -f2`
length=`grep Content-Length head.txt | cut -d " " -f2`
length=`filesize $length | sed -r "s/[ \t]{2,}//"`
-if [[ ! "$http" =~ "200" ]]
+if [[ "$http" =~ "301" || "$http" =~ "302" ]]
+then
+ echo "$http to $location"
+elif [[ ! "$http" =~ "200" ]]
then
echo $http
else