数组 arr=(A B C D 1 2 3 4) for i in "${!arr[@]}"; do printf "%s\t%s\n" "$i" "${arr[$i]}" done 数组长度 ${#array[@]} 参考链接 Shell脚本数组用法小结