文件名前的@(at)符号在curl命令中意味着什么?

文件名前的@(at)符号在curl命令中意味着什么?

我正在看一个curl命令示例它在文件名之前使用 @ 符号将数据发送到服务器。

curl http://localhost/ --data-binary @file.txt

这是什么意思?它是否将文件的内容插入到命令中?它具体针对吗curl

答案1

它是特定于卷曲的。从man curl

--data-binary <data>
  (HTTP) This posts data exactly as specified with no extra processing whatsoever.
  If you start the data with the letter @, the rest should be a filename.  Data is
  posted in a similar manner as --data-ascii does, except that newlines are preserved
  and conversions are never done.

  If this option is used several times, the ones following the first will append data
  as described in -d, --data.

相关内容