[Top][All Lists]

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

Re: read-only flag is lost for functions in sub shells

From: Chet Ramey
Subject: Re: read-only flag is lost for functions in sub shells
Date: Thu, 31 Jul 2014 15:00:24 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 7/31/14, 10:51 AM, Linda Walsh wrote:
> Chet Ramey wrote:
>> On 7/30/14, 6:11 PM, Linda Walsh wrote:
>>> If I assigned the read-only bit to an exported var and run a new
>>> shell, that var is still read-only.
>> No:
>> $ ./bash ./x24
>> 4.2.47(4)-release
>> foo = one
>> foo = two
>> $ cat ./x24
>> foo=one
>> readonly foo
>> export foo
>> ./bash -c 'echo foo = $foo ; foo=two ; echo foo = $foo'
> When did that change?

It's always been that way.

Maybe you could post some (minimal) sample code you're using that
illustrates the problem you're having.

> I thought the idea of RO vars being passed to children was considered
> desirable?  

As Greg says, there's no existing mechanism to do that using the
environment, which is the only way to communicate across exec(2).  I
could invent something, but what would be the point?

> (Not that I liked it that much, but am having some of my functions
> overwritten now when I didn't before... some odd things happening with .bashrc
> not being read @ login and not sure why, since I thought it was suppose to
> be read for any interactive shell


"When an interactive shell that is not a login shell  is  started,  bash
reads  and executes commands from ~/.bashrc, if that file exists."

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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