On 10/14/14, 2:17 PM, Linda Walsh wrote:
>
>
> Chet Ramey wrote:
>
>>
>>> Note that it's not only variable expansion, it's also tilde
>>> (even though ~ is also an arithmetic operator) expansion.
>>>
>>> $ HOME=1 a='b[~]' bash -c 'b=(1 2 3); echo $((a))'
>>> 2
>>>
>>> That means for instance th
Chet Ramey wrote:
Note that it's not only variable expansion, it's also tilde
(even though ~ is also an arithmetic operator) expansion.
$ HOME=1 a='b[~]' bash -c 'b=(1 2 3); echo $((a))'
2
That means for instance that
foo=-1
echo $((a[~foo]))
won't work on systems where there's a "foo
On 10/13/14, 10:28 AM, Stephane Chazelas wrote:
> 2014-10-13 09:02:38 -0400, Chet Ramey:
> [...]
>> You have to put it together. A variable need not be expanded before
>> arithmetic evaluation, so the evaluator expands, for instance, a bare
>> `a' to `b[$(echo 1+1)]'. When a variable is expanded,
2014-10-13 09:02:38 -0400, Chet Ramey:
[...]
> You have to put it together. A variable need not be expanded before
> arithmetic evaluation, so the evaluator expands, for instance, a bare
> `a' to `b[$(echo 1+1)]'. When a variable is expanded, its value is
> treated as an expression to be evaluate