I noticed that books and online manuals report two different orders for the recognition and the execution of expansions.
https://www.gnu.org/software/bash/manual/bash.html#Shell-Expansions
[diagram from a book][1] [1]: https://i.stack.imgur.com/b79Hw.jpg
Considering the following:
$(((5+2)))
7: command not found
- I think that the shell first recognizes the command substitution and then the arithmetic substitution.
- shell executes first the arithmetic substitution and then the command substitution
Is the order of parsing different from the order of execution or is the order on the image wrong? Why $((((5+2)))) gives 7: command not found just like $(((5+2))) ?