回音击所有阵列成员阵列时,在一个循环的变量引用 [英] Bash echo all array members when array is referenced as a variable in a loop

查看:132
本文介绍了回音击所有阵列成员阵列时,在一个循环的变量引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在回声的失败,我太迟钝找出原因。我只是想呼应所有数组成员在我的循环。

The "echo" below is failing and I am too retarded to figure out why. I am simply trying to echo all of the array members in my loop.

#!/bin/bash
foo=bar1,bar2
for i in ${foo//,/" "}
do
declare -a ${i}='(null null null null)'
echo ${i[*]}
done

任何帮助的感谢!

推荐答案

尝试评估回声\\ $ {$ I [*]}

你为什么做这种方式?有可能是一种更简单,更直接的方式做任何你的最终目标是。如果你形容的话,也许我们可以帮助您避免不必要的并发症。

Why are you doing it this way? There is probably an easier and more direct way to do whatever your ultimate goal is. If you describe it, perhaps we can help you avoid the unnecessary complication.

这篇关于回音击所有阵列成员阵列时,在一个循环的变量引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆