cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Curl returns exit code 18 for remote file

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 2 Aug 2011 13:16:38 -0700

On Tue, Aug 02, 2011 at 04:07:08PM -0400, James B. Byrne wrote:
> The problem we discovered with --head is that even with the --silent
> option it causes this to be displayed in STDOUT:
>
> Content-Length: 0

Yes, that's what --head requests.

> Which, in a cron job, causes a notification email to be sent for an
> expected occurrence. This I do not want. Nor do I wish to redirect
> STDOUT, for other reasons.

Then use the special curl option "-o /dev/null" and avoid the need to
redirect stdout yourself :-)

> Grep is a workable solution. In fact, that was our original
> approach. The difficulty being that the switch to cURL away from the
> basic ftp client was to get rid of that very idiom and avoid having
> to parse output to STDOUT. I just wanted a simple exit code and
> nothing else. And I just cannot seem to get it.

Those two additional options should do it. Don't forget that curl is
designed to transfer files, so outputing absolutely nothing goes against
its philosophy.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-08-02