通过脚本安装包

Package Installation through script

我明白以下脚本正在安装包,但我不明白是什么包:

for package in ${d[@]};
 do
     rpm -ivh --quiet ${!package} >/dev/null 2>&1

什么是 ${d[@]}

在这种情况下,'d' 是数组的名称。方括号中的“@”表示 'each element of the array individually'。

因此 'for' 遍历数组中列出的每个包。

关于 ${!package}(摘自 bash 手册 man bash 部分 'EXPANSION'):

If the first character of parameter is an exclamation point (!), a level of variable indirection is introduced. Bash uses the value of the variable formed from the rest of parameter as the name of the variable; this variable is then expanded and that value is used in the rest of the substitution, rather than the value of parameter itself. This is known as indirect expansion.

因为您没有 post 完整的脚本,所以我无法真正理解它是如何工作的。