On Wed, May 09, 2012 at 02:43:31PM -0600, Bill Gradwohl wrote:
> Nope. Wasn't aware of it. Thank You for the education.
Math contexts do an infinitely-recursing indirect parameter expansion
thingy:
imadev:~$ a=b b=c c=d d=e e=f f=42; echo $((a))
42
I hate the confusing advanced features like this. Who will really depend on this? Required by POSIX standards?
And there seems to be a weird difference between these two that I don't
fully understand:
(with a, b, c, d, e, f still defined as above)
imadev:~$ unset x
imadev:~$ declare -i -a x=(a); echo "$x"
a
imadev:~$ unset x
imadev:~$ declare -i -a x; x=(a); echo "$x"
42
Based on the previous messages in this thread, I guess this happens
because in the first one, the (a) is evaluated as a list of strings
(since the evaluation occurs before the array has been made "-i"??),
while in the second one, (a) is evaluated as a list of math contexts,
since it's being assigned to a "-i" array. I could be mistaken.