I would like to write a script where I try to download a file with wget (or curl if is really not something that can be done with wget) and do 2 actions if the file exists and it's downloaded correctly or... something else if the file is not downloaded correctly or is not found/server timeout/whatever else from being downloaded correctly.
How this can be achieved? Wget | sed/grep something -> == "200".. or a compare based on filesize shown in the headers.. ? then the actions?
-t 1
to ensure that when wget exits ok you will find the file under the expected filename, and not for example "file.1". See JeffSchaller's link.-O
option already in so it will always overwrite a specific file without adding the.1 .2 .3
..