Jeff Storey
Jeff Storey

Reputation: 57192

curl -D- option

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?

Upvotes: 7

Views: 5396

Answers (1)

Sylvain Leroux
Sylvain Leroux

Reputation: 52000

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)

Upvotes: 10

Related Questions