diff options
author | Martin Gütlein <martin.guetlein@gmail.com> | 2010-03-30 16:49:46 +0200 |
---|---|---|
committer | Martin Gütlein <martin.guetlein@gmail.com> | 2010-03-30 16:49:46 +0200 |
commit | 1a9419d158ede2535ae10b84d044da6a2cf89cfa (patch) | |
tree | 885b03c9018e78d61bf497bda8addc925d2857ae /bin | |
parent | ae0b071c42c37ea974aa234f30a3a8cb77aa7eb3 (diff) |
mostly munich changes
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/redirect.sh | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/bin/redirect.sh b/bin/redirect.sh index d309f1a..405a84d 100755 --- a/bin/redirect.sh +++ b/bin/redirect.sh @@ -1,18 +1,27 @@ #!/bin/bash -OUTFILE="/tmp/tmp_redirect_out" +OUTFILE="/tmp/tmp_redirect_out.txt" cmd="curl -v $1" `$cmd &> $OUTFILE` -RES=`grep "< HTTP.*303" $OUTFILE` +ERR=`grep -a "< HTTP.*5[0-9][0-9]" $OUTFILE` +ERR=${ERR// /} # remove emtpy spaces + +if [ -z $ERR ]; then + ERR="no error" +else + echo "ERROR" 1>&2 + exit 1 +fi + +RES=`grep -a "< HTTP.*30[0-9]" $OUTFILE` RES=${RES// /} # remove emtpy spaces #echo $RES if [ -z $RES ]; then - #echo "no" - echo "" + exit 0 else #cat $OUTFILE RES=`grep "< Location: " $OUTFILE` |