I have to run this command to install NPM. What does it do? What is the | at the end?
curl https://raw.githubusercontent.com/creationix/nvm/v0.23.2/install.sh | bash
Also, am I running UNIX-like commands in Bash? Why does this work? Is it that Bash is a UNIX-command compatible interface for the terminal?
In Bash (and most *nix shells), the |
(pipe) metacharacter¹ causes the shell to take the output from one command and uses it as the input for the next command.
What you are doing here is using curl
to retrieve the install.sh
file and then output its contents into bash
, which is a shell that will execute the contents of install.sh
.
In short, you are downloading and running the install.sh
script.
|
, >
, <
, etc are shell metacharacters.