|
From: | Pierre Gaston |
Subject: | Re: Curious case of arithmetic expansion |
Date: | Sun, 23 Apr 2017 16:19:52 +0300 |
It does not matter, how this construct in this particular context is called.The difference between $(()) and (()) is that $(()) actually expands to somethingwhereas (()) just executes a C-like _expression_. In ((<_expression_>)) <_expression_> can alsoinclude assignments, as the bash manual that you properly cited, also elaborates on.You can do, for example, things like$ foo=2$ ((foo+=100)) # fo is now 102$ ((++(foo++)))or even$ ((foo++, foo++, foo++, foo++, foo+=100))and (oh boy why) even$ foo=(123 321)$ ((foo[0]++, foo[1]—))So I might have chosen the wrong subject text for this mail,but again, it does not matter whether those constructs actually expand to some stringor not. The side effects are what matter here. And in my opinion those are not correct...
[Prev in Thread] | Current Thread | [Next in Thread] |