i have a simple script
wget -O file.zip www.site.com/asdqwdkjhasd.zip
unzip file.zip
and i call the script
./script.sh
now my problem is if zip file is corrupt then it outputs
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
how can i detect this text in script? If the output of the program contains the string "End-of-central-directory signature not found." then do something.
sometimes the downloaded zip is corrupt so it has to be redownloaded. How can i check if the output is "End-of-central-directory signature not found." and if so redownload i.e execute wget and again unzip. In other words how to loop until download and extract succeeds?
How can i achieve this in bash scripting?
I appreciate any help! Thanks!
UPDATE:
Sorry i have made a slight change to the problem. This is the actual problem i am trying to solve. Thanks for any feedbacks!