6

I was reading the JIRA REST API tutorial and in their example curl request, they show

curl -D- -u username:password <rest-of-request>

What is the -D- syntax with the dash before and after?

Jeff Storey
  • 56,312
  • 72
  • 233
  • 406
  • 4
    See [Curl post data and headers only](http://stackoverflow.com/a/287299/1983854) : `-D- Dump the header to the file listed, or stdout when - is passed` – fedorqui Jul 29 '14 at 14:13

1 Answers1

8

To quote man curl:

  -D, --dump-header <file>
          Write the protocol headers to the specified file.

          This  option is handy to use when you want to store
          the headers that a HTTP site sends to you. C

After a -D you normally give the name of the file where you want to dump the headers. As with many utilities, - is recognized as an alias to stdout.
(if you're not familiar with that concept: when you launch the command from a terminal without redirection, stdout is the "terminal screen")

The -D- (without space) form is exactly the same as -D - (or on Linux at least, -D /dev/stdout)

Community
  • 1
  • 1
Sylvain Leroux
  • 50,096
  • 7
  • 103
  • 125
  • 1
    Interesting! I see this interesting and related post: [Does “ - ” mean stdout in bash?](http://stackoverflow.com/q/3797795/1983854) – fedorqui Jul 29 '14 at 14:23