命令替换得到$((2+3))为什么没有继续扩展?
# generateArithmeticExpand
generateArithmeticExpand() {
echo '$((2+3))'
}
echo $(generateArithmeticExpand)
# => $((2+3))
for i in $(generateArithmeticExpand)
do
echo $i
done
# => $((2+3))
在展开的顺序中arithmetic expand
在command substitution
之后进行的,为什么arithmetic expand
没有执行呢?
如果这里的命令替换得到的是*
,它是会继续进行filename expand
的。
bash
arithmetic expansion 在 command substitution 之前。