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 *-

They have used that syntax since that line was first introduced in 2011. You might ask Wael Nasreddine (@kalbasit on GitHub) why he did it. He is still active on that repo.

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.

Need Your Help

Lazy loading - what's the best approach?

c# architecture coding-style lazy-loading methodology

I have seen numerous examples of lazy loading - what's your choice?

ASP.NET MVC TDD with LINQ and SQL database

sql asp.net-mvc linq tdd

I am trying to start a new MVC project with tests and I thought the best way to go would have 2 databases. 1 for testing against and 1 for when I run the app and use it (also test really as it's not