卷曲 -D- 选项

Jef*_*rey 6 bash curl

我正在阅读 JIRA REST API 教程,在他们的示例卷曲请求中,他们显示

curl -D- -u username:password <rest-of-request>
Run Code Online (Sandbox Code Playgroud)

-D-前后加破折号的语法是什么?

Syl*_*oux 9

去引用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
Run Code Online (Sandbox Code Playgroud)

在 a 之后,-D您通常会给出要转储标头的文件的名称。与许多实用程序一样,-被识别为stdout的别名
(如果您不熟悉这个概念:当您从终端启动命令而不重定向时,stdout是“终端屏幕”)

(不带空格)形式与(或至少在 Linux 上,)-D-完全相同-D --D /dev/stdout