diff options
author | Luke Bratch <l_bratch@yahoo.co.uk> | 2014-08-04 11:32:49 +0100 |
---|---|---|
committer | Luke Bratch <l_bratch@yahoo.co.uk> | 2014-08-04 11:32:49 +0100 |
commit | 4dd62f4540210e2143497943c5c51062c57cd73e (patch) | |
tree | 1d6bb67508d11669314a5dac727428fedb5bf45b /head.bash | |
parent | 181c0a0f2577e0c6417ba1173b170d1427659915 (diff) |
Diffstat (limited to 'head.bash')
-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 |