[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 16:07:11 -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, 3:36 PM, Chris F.A. Johnson wrote:
> On Thu, 31 Jul 2014, Chet Ramey wrote:
>> On 7/31/14, 10:51 AM, Linda Walsh wrote:
> ...
>>> 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?
>
> It's not hard to do, e.g. as a comma-separated list of readonly
> variables:
>
> export READONLY_VARS=foo,bar,why,not foo bar why not
Sure. You're inventing an out-of-band communication mechanism that uses
the environment. The advantage of this is that it's done outside the
shell at the script level.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/