In order to "run link checks" in scrips, it would be beneficial to use both of these options:
curl --head --silent $URL || echo "FAIL: $URL"
Unfortunately the --silent option does not suppress the HEAD output in 7.26.0.
$ curl --head --silent http://www.google.com/
HTTP/1.1 302 Found
Location: http://www.google.fi/
Cache-Control: private
Content-Type: text/html; charset=UTF-8
...
Date: Tue, 28 May 2013 05:46:09 GMT
Server: gws
Content-Length: 218
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
$ echo $?
0
This is not a bug.
--silent only silences curl's "extra" output. Data you ask for from a URL will still be output as usual. --head to a HTTP URL will thus output a HEAD response.
Could this be clarified in the --silence output better. Thanks.
An option to complete silence (--quiet, or "--silence all") would be a welcomed addition in cases like above where only the return code is needed.
Last edit: Jari Aalto 2013-05-28
Something to consider.
From user's perspective, the current behavior is odd:
That's odd behavior when accustomed to all other programs where "silent" means "less output" or "real silence" (equiv. --quiet in many programs).
Last edit: Jari Aalto 2013-05-28
--silent does not inhibit data so that's the wrong way to do it. Redirect the data with -o or > if you want to hide it from stdout.
It would be nice if this were clarified in the manual page of the --silent option in next release.