Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11933

Re: An array variable created by export/readonly builtins inside a function becomes a locale variable to that function unexpectedly

From Piotr Grzybowski <narsil.pl@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: An array variable created by export/readonly builtins inside a function becomes a locale variable to that function unexpectedly
Date 2015-11-28 10:43 +0100
Message-ID <mailman.858.1448703800.31583.bug-bash@gnu.org> (permalink)
References <70266BC6-C65A-4D95-B7C1-2F63F3C45DEF@qq.com>

Show all headers | View raw


hey,

 this is triggered by (), since the following works as "expected":

bash -c 'foo() { readonly a=1; echo a=$a; }; foo; echo a=$a'

 cheers,
pg


On Sat, Nov 28, 2015 at 4:18 AM, ziyunfei <446240525@qq.com> wrote:
> $ ksh -c 'foo() { readonly a=(1);echo a=$a; }; foo; echo a=$a'
> a=1
> a=1
> $ bash -c 'foo() { readonly a=(1);echo a=$a; }; foo; echo a=$a' # a becomes a local variable
> a=1
> a=
>
>

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: An array variable created by export/readonly builtins inside a function becomes a locale variable to that function unexpectedly Piotr Grzybowski <narsil.pl@gmail.com> - 2015-11-28 10:43 +0100

csiph-web