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

rob*_*rod 44 shell curl

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

curl http://localhost/ --data-binary @file.txt
Run Code Online (Sandbox Code Playgroud)

这是什么意思?它是否将文件的内容插入到命令中?是特定的curl吗?

Ulr*_*gel 47

它特定于 curl。来自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.
Run Code Online (Sandbox Code Playgroud)

  • 我应该去那里看看。不过,我希望它是一个外壳。太感谢了。 (4认同)