bug-bash
[Top][All Lists]
Advanced

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

Re: local -r issue in conjunction with trap


From: Chet Ramey
Subject: Re: local -r issue in conjunction with trap
Date: Sun, 17 Jul 2022 17:40:28 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.10.0

On 7/15/22 7:06 PM, Koichi Murase wrote:
2022年7月16日(土) 7:28 Lawrence Velázquez <vq@larryv.me>:
You can't shadow a readonly variable:

https://lists.gnu.org/archive/html/bug-bash/2019-03/msg00152.html
https://lists.gnu.org/archive/html/bug-bash/2019-03/msg00153.html
https://lists.gnu.org/archive/html/bug-bash/2020-04/msg00201.html
https://lists.gnu.org/archive/html/bug-bash/2020-04/msg00204.html

We can shadow local readonly variables. What we cannot are global
readonly variables.

It seems to me a bug.

It's not a bug. Bash-2.04 introduced behavior to disallow local variables
with the same name as readonly variables in a previous scope (whether a
local scope or not). I got requests to relax it, and the result is the
current behavior of restricting it to shadowing readonly variables at the
global scope.

There are discussions about this going back at least 10-15 years. I got
bored and stopped looking after one from 2011:

https://lists.gnu.org/archive/html/bug-bash/2011-02/msg00194.html

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