Openwrt shell 变量值作为变量名

38次阅读

共计 95 个字符,预计需要花费 1 分钟才能阅读完成。

b=c
ac=1
d="a${b}"

想将 b 的值作为变量名,输出 1,echo ${!d} 返回 -ash: syntax error: bad substitution,有没有别的方法(如果不用定义 d 就更好)?

正文完
 0