help-bash
[Top][All Lists]
Advanced

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

local functions


From: Christof Warlich
Subject: local functions
Date: Thu, 10 Dec 2020 14:34:39 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi,

$ help declare

says:

   ...
    When used in a function, `declare' makes NAMEs local, as with the
`local'
    command.
    ...

Furthermore, bash allows to define a function within another function:

$ f() {
    echo f
    declare -f g
    g() {
        echo g
    }
}
$ f
f
g

But g is not local:

$ g
g

Thus, either the documentation or bash's behavior seens to be wrong, right?

Cheers,

Chris





reply via email to

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