2022年7月16日(土) 7:28 Lawrence Velázquez <[email protected]>:
> 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. While the following works,
$ bash-dev -ec 'T(){ local -r v=; }; trap T 0; F() { local -r v=; exit; }; F'
the following fails
$ bash-dev -e <<< 'T(){ local -r v=; }; trap T 0; F() { local -r v=; exit; }; F'
main: line 1: local: v: readonly variable
Tested on the current devel 87a6e89e (+ define(relstatus, release) in
configure.ac)
--
Koichi