📜  用于填充关联数组的 bash 函数 - 无论代码示例

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

代码示例1
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