6

I saw on https://github.com/nvm-sh/nvm that they would suggest using

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

to do the installation of nvm. But I searched everywhere and the manpage of curl but don't see curl -o- (I see curl -o but not what curl -o- means)

What does it do?

nonopolarity
  • 3,069

2 Answers2

9

It's an alias for --output, which is mentioned a few times in the man page.

OUTPUT
If not told otherwise, curl writes the received data to stdout. It can be instructed to instead save that data into a local file, using the -o, --output or -O, --remote-name options.

OPTIONS
Options start with one or two dashes. Many of the options require an additional value next to them.

-o, --output <file>
Write output to <file> instead of stdout. [...] Specifying the output as '-' (a single dash) will force the output to be done to stdout.

(curl -o- and curl -o - act the same.)

Explicitly sending the output to stdout seems a bit redundant, since that's the default anyway. However, the man page does mention using multiple -o options for multiple URLs to download, so it might be more useful in that context.

ilkkachu
  • 138,973
2

-o option in the manpage:

-o, --output <file>

    Write output to <file> instead of stdout....

The - after -o tells curl that the output file is stdout.

GAD3R
  • 66,769
  • 3
    so I think the default is STDOUT and so -o- is just redundant? – nonopolarity Mar 28 '21 at 12:34
  • 1
    @nonopolarity, looks like. If I read the man page correctly, it could take multiple -o options for multiple files, and in that case, you'd maybe have more use for it – ilkkachu Mar 28 '21 at 12:37