Menu

#1231 7.26.0 Option --silent does not work with --head

closed-invalid
None
5
2013-06-21
2013-05-28
Jari Aalto
No

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

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2013-05-28
    • status: open --> pending-invalid
    • assigned_to: Daniel Stenberg
     
  • Daniel Stenberg

    Daniel Stenberg - 2013-05-28

    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.

     
  • Jari Aalto

    Jari Aalto - 2013-05-28

    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
  • Jari Aalto

    Jari Aalto - 2013-05-28

    Something to consider.

    From user's perspective, the current behavior is odd:

    --head
    => outputs data
    
    "Hm, I don't want that data, only the return code"
    --head --silent
    => still data
    
    ??
    

    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
  • Daniel Stenberg

    Daniel Stenberg - 2013-05-28
    • status: pending-invalid --> closed-invalid
     
  • Daniel Stenberg

    Daniel Stenberg - 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.

     
  • Jari Aalto

    Jari Aalto - 2013-05-28

    It would be nice if this were clarified in the manual page of the --silent option in next release.

     
MongoDB Logo MongoDB