在curl命令中,文件名前的@(@)符号是什么意思?


37

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

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

这是什么意思?是否将文件内容插入命令?是特定于curl

Answers:


42

它特定于卷曲。来自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.

3
我应该去那儿看。我原以为这将是一件空壳的事情。太感谢了。
robingrindrod 2014年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.