|
From: | Dan Douglas |
Subject: | Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok |
Date: | Mon, 22 Jul 2013 06:57:03 -0500 |
User-agent: | KMail/4.10.5 (Linux/3.10.1-pf+; KDE/4.10.5; x86_64; ; ) |
$ bash -xc 'declare -i a=(1 x 3)' + a=(1 x 3) + declare -i a $ bash -xc 'declare -i a=x' + declare -i a=x That is how bash treats it, and the reason they differ. There are some useful properties to this. Remember arithmetic gets recursive evaluation in Bash so "x" is still going to end up evaluating to whatever expression is stored in x. If you want, you can force it to behave the other way as shown in my first reply. The primary reason I said it isn't a bug is because this has been discussed on the list a few times before and that's been the general consensus. -- Dan Douglas
[Prev in Thread] | Current Thread | [Next in Thread] |