curl / Mailing Lists / curl-users / Single Mail

curl-users

Exit code if file is or is not downloaded

From: Gerard Seibert <gerard_seibert_at_outlook.com>
Date: Mon, 15 Apr 2019 16:56:12 +0000

I am using curl as shown here: curl -s -L -R -z "file-name" -O "URL"

What I would like to know is if there is a way to have curl issue an
exit code depending on whether or not it actually downloaded a newer
file. Apparently, curl always exits on "0" unless an error occurs which
means I have to check to see if a newer file was fetched.

The command is being run via a shell script from CRON. Right now I am
comparing the files to see if a newer one was downloaded. It would be
easier if curl simply issued an exit code to indicate that it did or
didn't fetch a newer file.

If this is not currently available in curl, it might be a nice feature
to add to it at some time.

Thanks!

-- 
Gerard

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html

Received on 2019-04-15