dingzhihu
dingzhihu

Reputation: 81

can someone explain the following homebrew install command?

What does the "$" sign mean in following command? ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Upvotes: 0

Views: 46

Answers (1)

Stefan
Stefan

Reputation: 114128

This is a shell feature called command substitution. $(command) is replaced by the command's output:

$ echo puts 1 + 2
puts 1 + 2

$ ruby -e "$(echo puts 1 + 2)"
3

The second line is equivalent to ruby -e "puts 1 + 2".

In your example, the curl command downloads and ouputs the Ruby file and ruby -e evaluates it.

Upvotes: 2

Related Questions