On 8/9/25 1:09 AM, Oğuz wrote:
On Friday, August 8, 2025, Oğuz <oguzismailuy...@gmail.com <mailto:oguzismailuy...@gmail.com>> wrote:
 > declare -in x

There's also this:

     $ declare -in x=a[x]
     $ echo $?
     1
     $ declare -p x
     bash: declare: x: not found

The 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    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to