bug-bash
[Top][All Lists]
Advanced

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

Re: unset does not remove functions like a[b] unless -f is specified


From: Chet Ramey
Subject: Re: unset does not remove functions like a[b] unless -f is specified
Date: Fri, 3 Feb 2023 11:10:21 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.0

On 1/31/23 2:33 PM, Dale R. Worley wrote:

So it does seem that a function named "a[0]" is valid in default mode.

Of course it is.


        unset [-fv] [-n] [name ...]
               ...  If no options are
               supplied, each name refers to a variable; if there is  no  vari‐
               able  by that name, a function with that name, if any, is unset.

So taking that text strictly, "unset a[0]" should attempt to remove the
variable a[0], and if it does not exist, attempt to remove the function
a[0] that name.

As long as there isn't an existing array variable a. In this theoretical
exercise, trying to remove an unset subscript and actually removing a shell
function would be worse.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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