bug-bash
[Top][All Lists]
Advanced

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

Re: declare -F incorrect line number


From: Greg Wooledge
Subject: Re: declare -F incorrect line number
Date: Thu, 6 Oct 2022 13:16:44 -0400

On Fri, Oct 07, 2022 at 01:28:59AM +1000, Martin D Kealey wrote:
> I write nested functions quite often, usually with a subsequent `unset -f`
> but sometimes (necessarily) without.
> 
> Being able to write `local -F funcname { ... }` or `function -L funcname {
> ... }` would be a nice replacement for the former, but the latter is
> usually about different phases of execution, rather than abstractions for
> different data.

You do realize that there are no "nested functions" in bash, right?  All
functions exist in a single, global function namespace.

unicorn:~$ bash
unicorn:~$ f() { g() { echo I am g; }; }
unicorn:~$ f
unicorn:~$ type g
g is a function
g () 
{ 
    echo I am g
}

Functions are never "local".



reply via email to

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