Hi All,
I have zip file that needs to be validated and checked for 5 times with sleep of 60 seconds. Some thing like below
#!/bin/bash
counter=1
while [ "$counter" -le 5 ]
do
curl -i -k -X GET `strings tmp.txt |grep Location| cut -f2 -d" "` -H "Authorization: Token $TOKEN" -o $zip_file ## this is where the zip file gets generated
RC=$?
if [ "$RC" -eq 0 ]
then
echo "Zip file is valid"
break
fi
echo -e "Zip file is not valid for ${counter} time"
sleep 60
counter=$(( counter + 1 ))
if [ "$counter" -eq 11 ]
then
echo -e "After $(( $counter - 1 )) attempts, FAILED!"
exit 1
fi
done
I need to validate the zip file after it gets generated using curl command. Basically needs to validate like below
file $zip_file|grep -v Zip
file.zip: data