Why use -Lo- with curl when piping to bash?
In the janus project, they use curl to download and pipe a bootstrap script into bash. https://github.com/carlhuda/janus
It looks like this:
$ curl -Lo- https://bit.ly/janus-bootstrap | bash
Why would one want to use the args -Lo-?
-o is supposed to be for output, but wouldn't that happen anyway (i.e. to stdout)?
The -o is redundant, they produce the exact same output:
$ curl --silent example.com | sha256sum 3587cb776ce0e4e8237f215800b7dffba0f25865cb84550e87ea8bbac838c423 *- $ curl --silent --output - example.com | sha256sum 3587cb776ce0e4e8237f215800b7dffba0f25865cb84550e87ea8bbac838c423 *-
It's all in the man pages:
-L in case the page has moved (3xx response) curl will redirect the request to the new address
-o output to a file instead of stdout (usually the screen). In your case the o flag is redundant since the output is piped to bash (for execution) - not to a file.