Possible Duplicate:
What does it mean “bash < <( curl rvm.io/releases/rvm-install-head )”
I'm working to install Ruby on Rails on Mac OS X lion and came across several tutorials which called on this line:
bash < <(curl -s https://rvm.io/install/rvm)
I don't know what the bash < <
bit is for.
What does this line do?
Thanks
The first <
redirects the file on the right side to the stdin
of the command on the left side.
The <(...)
syntax runs the command specified, saving its output to a named pipe (a special kind of file that outputs whatever is written into it without saving it to the disk) and replaces the whole <(...)
with the name of the file. This is called process substitution (you can look it up in man bash
) and it is used whenever a file would be needed but you want to use the output of a command instead.
As for curl
, it is a command which downloads the URL given to it as argument, and outputs it to the screen (stdout
).
In summary, what the command you gave does is:
https://rvm.io/install/rvm
, which is a bash script, and saves it to the temporary named pipe given as input to bash.This effectively runs the script at the URL with bash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With