diff options
-rwxr-xr-x | head.bash | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |