[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read-only flag is lost for functions in sub shells
From: |
Greg Wooledge |
Subject: |
Re: read-only flag is lost for functions in sub shells |
Date: |
Thu, 31 Jul 2014 10:57:27 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Jul 31, 2014 at 07:51:01AM -0700, Linda Walsh wrote:
> Chet Ramey wrote:
> >$ ./bash ./x24
> >4.2.47(4)-release
> >foo = one
> >foo = two
> >$ cat ./x24
> >echo $BASH_VERSION
> >
> >foo=one
> >readonly foo
> >export foo
> >
> >./bash -c 'echo foo = $foo ; foo=two ; echo foo = $foo'
>
> When did that change?
You might be confusing subshells with explicit new process creation.
Attributes like readonly are not passed through the environment.
How could they be? What out-of-band facility is available to mark
environment variables as having these attributes?
imadev:~$ cat ./x24
echo "$BASH_VERSION"
foo=one
readonly foo
export foo
bash-2.05b -c 'echo "foo=<$foo>"; foo=two; echo "foo=<$foo>"'
imadev:~$ bash-2.05b ./x24
2.05b.0(2)-release
foo=<one>
foo=<two>