📜  bash 间接访问数组 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:59.445000             🧑  作者: Mango

代码示例1
#!/usr/bin/env bash

ARRAYNAME='FRUITS'
FRUITS=( APPLE BANANA ORANGE )

eval array=\( \${${ARRAYNAME}[@]} \)

for fruit in "${array[@]}"; do
  echo ${fruit}
done