On 9/1/25 2:14 PM, Chet Ramey wrote:
On 8/30/25 12:22 PM, Zachary Santer wrote:
On Sat, Aug 30, 2025 at 11:41 AM Chet Ramey <[email protected]> wrote:

It occurs to me that bash should print a warning when you attempt something
like this:

declare -n foo=bar
declare -i foo

since bash disallows that now by ignoring the attempt to add the integer
attribute

The manual explicitly lays this out as something you can do:

Sorry, you're right. This indeed changes the attributes on the target variable, if you're applying it to an already-declared nameref. It's trying to give thenameref variable itself the integer attribute that is the problem.

So the question is now whether to disallow `declare -in foo' (or
`declare -in foo=bar') and make it a usage error, print a warning that
it will be ineffective, or simply let it be ineffective, as it is now.


--
``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/

Reply via email to