bug-bash
[Top][All Lists]
Advanced

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

Re: An array variable created by export/readonly builtins inside a funct


From: Piotr Grzybowski
Subject: Re: An array variable created by export/readonly builtins inside a function becomes a locale variable to that function unexpectedly
Date: Sat, 28 Nov 2015 10:43:15 +0100

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 <address@hidden> 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=
>
>



reply via email to

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