如何在Bash中构造一个数组数组

时间:2017-01-13 18:38:09

标签: arrays bash

我正在尝试在bash中创建一个数组数组。在红宝石中它会像:

projects = [
  ["PROJECT_ID_1", "PROJECT_TOKEN_1"],
  ["PROJECT_ID_2", "PROJECT_TOKEN_2"],
  ["PROJECT_ID_3", "PROJECT_TOKEN_3"],
  ["PROJECT_ID_4", "PROJECT_TOKEN_4"]
]

这显然不适用于bash,但我无法正确理解语法。我知道我必须做类似的事情:

declare -a PROJECTS=()
# What goes here?

在bash中执行此操作的正确方法是什么?

0 个答案:

没有答案