Could someone please explain this bash command?
From the website for RVM:
bash < <( curl https://rvm.io/releases/rvm-install-head )
What does that first less-than symbol do? What about the <(
? I know this is a stupid question, but I开发者_如何学运维'd love to understand this.
Bash's process substitution replaces <( ... )
and >( ... )
with pipes from/to children. Hence the whole thing means "create a pipe from curl ...
, and use it as stdin to bash".
Rather pointless, it would be better written
curl -L https://get.rvm.io | bash
It's called process substitution. The ouput of the curl
command is sent via an anonymous named pipe to the standard input of bash
. Basically what that whole command is doing is executing what's retrieved by curl
as a shell script.
I consider it risky, but some people seem to be OK with it. If you retrieve the file and run it in a separate step, though, you have an opportunity to inspect it first. Whatever you do, if you do it together don't run it as root or under sudo
.
精彩评论