2017-01-23 82 views
0

在bash中,可以使用"$(< file)"格式將文件作爲參數。 $(<的大概特殊外殼的文檔在哪裏?

+0

man手冊中提到它。 – Shiping

+1

您是否試圖簡單地在'bash'手冊中尋找'$(<'' – Barmar

+0

)我在理解這個問題時遇到了一些麻煩。您是否想要將FILENAME放入變量中,或者將文件的CONTENTS變爲變量?我不明白你想要做什麼。 –

回答

3

它在手冊頁,在 「命令替換」:

Command Substitution 
     Command substitution allows the output of a command to replace the com- 
     mand name. There are two forms: 

       $(command) 
     or 
       `command` 

     Bash performs the expansion by executing command in a subshell environ- 
     ment and replacing the command substitution with the standard output of 
     the command, with any trailing newlines deleted. Embedded newlines are 
     not deleted, but they may be removed during word splitting. The com- 
     mand substitution $(cat file) can be replaced by the equivalent but 
     faster $(< file).