On 8/9/25 1:09 AM, Oğuz wrote:
On Friday, August 8, 2025, Oğuz <[email protected] <mailto:[email protected]>> wrote:> declare -in xThere's also this: $ declare -in x=a[x] $ echo $? 1 $ declare -p x bash: declare: x: not foundThe error here shouldn't be silent.
Since you have -i, the a[x] expands to `0', which is an invalid name for
a nameref, resulting in an assignment error. I can add an error message
for this case, since the original value (a[x]) is valid, something like
declare: a[x]: expands to invalid variable name for name reference
Now, since you have attempted to create a nameref with an invalid value,
`declare' has a choice: refuse to create the nameref, or create x as a
`regular' variable. It chooses the former.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
