I need to request a page n times and count the number of error-pages returned
ITERATIONS=100000
COUNTER=0;
COUNT_ERROR=0;
COUNT_EXPECTED=0;
while (( $COUNTER < $ITERATIONS )); do
COUNTER=$((COUNTER + 1));
curl http://ift.tt/1NiKrMD | grep -cim1 error;
if (( $? == 0 )); then
COUNT_ERROR=$((COUNT_ERROR + 1))
else
COUNT_EXPECTED=$((COUNT_EXPECTED + 1))
fi;
sleep 0.1;
done;
echo COUNT_ERROR=$COUNT_ERROR COUNT_EXPECTED=$COUNT_EXPECTED
This script is returning
COUNT_ERROR=0 COUNT_EXPECTED=0
... so the if clause is not executing as expected
Aucun commentaire:
Enregistrer un commentaire