命令替换得到$((2+3))为什么没有继续扩展?-灵析社区

我头像最美

命令替换得到$((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`的。

阅读量:204

点赞量:0

问AI
"bash" (https://link.segmentfault.com/?enc=IgdoFyLerm89kJJzhMgqlA%3D%3D.qd%2B4RFiYGeETDk7SxCXS4wmUCmmVzts1tqkMTvZv3tM%3D) «The order of expansions is: brace expansion; tilde expansion, parameter and variable expansion, arithmetic expansion, and command substitution (done in a left-to-right fashion); word splitting; and pathname expansion.» arithmetic expansion 在 command substitution 之前。