I’m trying to install RVM. There is a magical command line:
bash < <(curl -s https://rvm.io/install/rvm)
I know what bash and curl are. I know the first < is the I/O redirection. But what does <() syntax mean?
What’s the difference between this command and
bash < `curl -s https://rvm.io/install/rvm`
?(the latter command doesn’t work)
This is bash’s process substitution.
The expression
<(list)gets replaced by a file name, either a named FIFO or an entry under/dev/fd. So to actually redirect input from it, you have to use< <(list).[edit; forgot to answer your second question]
The backticks are called “command substitution”. Unlike process substitution, it is part of the POSIX shell specification (i.e., not a bash extension). The shell runs the command in the backticks and substitutes its output on the command line. So this would make sense:
But this would not:
The latter is similar to your example; it tries to use the (complex) output of a command as a file name from which to redirect standard input.