22

Bash 包含不同的大括号,它们的使用方式也不同。您能否全面解释一下和之间${}的区别?它们在 bash 中用在哪里?他们的主要目的是什么?$()$[]

4

1 回答 1

12

The keyword is shell expansion! So i highly recommend you to read the section Shell Expansions in your bash reference manual.

You can access this section online [1].

The names of the following stated forms are:

  • ${} Parameter expansion
  • $() Command substitution

the form $[] isn't actually stated in the manual so i wouldn't use it.

[1] http://www.gnu.org/software/bash/manual/bashref.html#Shell-Expansions

于 2013-08-01T11:33:07.537 回答