在 janus 项目中,他们使用 curl 下载引导脚本并将其通过管道传输到 bash。 https://github.com/carlhuda/janus
它看起来像这样:
$ curl -Lo- https://bit.ly/janus-bootstrap | bash
Run Code Online (Sandbox Code Playgroud)
为什么要使用 args -Lo-?
-o 应该用于输出,但无论如何不会发生(即到标准输出)?
小智 6
这-o是多余的,它们产生完全相同的输出:
$ curl --silent example.com | sha256sum\n3587cb776ce0e4e8237f215800b7dffba0f25865cb84550e87ea8bbac838c423 *-\n\n$ curl --silent --output - example.com | sha256sum\n3587cb776ce0e4e8237f215800b7dffba0f25865cb84550e87ea8bbac838c423 *-\nRun Code Online (Sandbox Code Playgroud)\n自 2011 年首次引入该行以来,他们就一直使用该语法。\n您可能会问 Wael\xc2\xa0Nasreddine ( @kalbasit)他为什么这样做。他仍然活跃于该仓库。
\n