[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Can not declare a local variable if an global ro-variable exists with th
From: |
joergboe |
Subject: |
Can not declare a local variable if an global ro-variable exists with the same name |
Date: |
Wed, 27 Mar 2019 14:06:51 +0100 (CET) |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I. -I./include -I./lib -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
uname output: Linux ocde150562 3.10.0-957.10.1.el7.x86_64 #1 SMP Thu Feb 7
07:12:53 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu
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.
Repeat-By:
$ declare -r var=55
$ myfunction() {
> local var=11
> echo "\$var=$var"
> return 0
> }
$ myfunction
bash: local: var: readonly variable
$var=55
- Can not declare a local variable if an global ro-variable exists with the same name,
joergboe <=