📜  从输出 bash 填充关联数组 - 无论代码示例

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

代码示例2
declare -a cols
while read num color; do
    cols[$num]=$color
done < file.txt
for key in "${!cols[@]}"; do printf "%s\t%s\n" "$key" "${cols[$key]}"; done