0
下面的命令中「$」符號的含義是什麼? ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
有人可以解釋下面的homebrew安裝命令嗎?
下面的命令中「$」符號的含義是什麼? ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
有人可以解釋下面的homebrew安裝命令嗎?
這是一個叫做command substitution的shell特徵。 $(command)
替換爲命令的輸出:
$ echo puts 1 + 2
puts 1 + 2
$ ruby -e "$(echo puts 1 + 2)"
3
第二行相當於ruby -e "puts 1 + 2"
。
在您的示例中,curl
命令下載並輸出Ruby file和ruby -e
對其進行評估。
下載並執行ruby中該鏈接上的代碼 – aelor 2014-09-29 07:32:48
ruby評估curl命令的輸出 – 2014-09-29 07:51:33