[Top][All Lists]

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

Re: undo local variable with unset

From: Chet Ramey
Subject: Re: undo local variable with unset
Date: Tue, 06 Jan 2015 09:11:37 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 1/5/15 3:14 PM, Poor Yorick wrote:
> In the following script, the effect of calling f0 is that the value global $i
> is still 5, but the effect of calling f1 is that the value of the global $i is
> 9.  It's nice to be able to create a function like unlocal that moves local
> variables out of the way, but I'm wondering if it can be relied on in future
> versions:

This is a consequence of bash's dynamic scoping and the idea that a local
variable should stay local if it's unset at the current scope.  I don't
have any plans to change that.

``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]