问题
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.
回答1:
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
回答2:
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.
来源:https://stackoverflow.com/questions/5228150/could-someone-please-explain-this-bash-command