Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
You should say what shell you are using (bash/ksh etc.). Also have you read the wget man page ... it's very good, I'd be surprised if there wasn't some help.
Let me explain, the command i am using is : if (wget -O /path/somefile.tar.gz $REPO_URL), here i am trying to check if somefle.tar.gz is present in my repository and if it is present then download it, now it works well if the file is present however if the file is not present then it creates an empty file "somefile.tar.gz" which i do not want...I want to prevent the creation of empty file..
Hi Daniel, I tried with your suggestion earlier, however as i am using it within if it always evaluates to true and which i dont want..it should not go into the loop if the file is not present.
wget -O file || rm file
. Error responses from the server cause wget to return a non-zero exit code.