bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can not declare a local variable if an global ro-variable exists wit


From: Chet Ramey
Subject: Re: Can not declare a local variable if an global ro-variable exists with the same name
Date: Fri, 29 Mar 2019 08:47:53 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.0

On 3/27/19 9:06 AM, joergboe@snafu.de wrote:

> Bash Version: 4.2
> Patch Level: 46
> Release Status: release
> 
> Description:
>       If I declare a global read-only variable and I try to declare a local 
> variable with that name, I can not create
>       the local variable.
>       I expect that local variables can be declared independently for the 
> global variables.

Yes, it's been that way for about as long as bash has had local variables.
The idea is that variables are readonly for a reason, and you shouldn't
just be able to circumvent that with a local variable declaration. It's
similar to the error you get if you try to assign a value to a readonly
variable using an assignment statement that precedes a command.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]