If I try downloading a file which already exists with wget using the --no-clobber option, it works as expected but the exit code is 1 which is crashing my scripts. Why does this result in a non-zero exit code?
$ wget -nc --output-document "/home/User/Downloads/sample.pdf" http://www.africau.edu/images/default/sample.pdf --2021-02-07 17:52:01-- http://www.africau.edu/images/default/sample.pdf Resolving www.africau.edu (www.africau.edu)... 172.67.148.215, 104.21.63.175, 2606:4700:3030::ac43:94d7, ... Connecting to www.africau.edu (www.africau.edu)|172.67.148.215|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 3028 (3.0K) [application/pdf] Saving to: ‘/home/User/Downloads/sample.pdf’ /home/User/Downloads/sample.pdf 100%[===============================================================================================================>] 2.96K --.-KB/s in 0s 2021-02-07 17:52:01 (137 MB/s) - ‘/home/User/Downloads/sample.pdf’ saved [3028/3028] $ echo $? 0 $ wget -nc --output-document "/home/User/Downloads/sample.pdf" http://www.africau.edu/images/default/sample.pdf File ‘/home/User/Downloads/sample.pdf’ already there; not retrieving. $ echo $? 1
