bug-bash
[Top][All Lists]
Advanced

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

Re: local -p var prints nothing


From: Lawrence Velázquez
Subject: Re: local -p var prints nothing
Date: Fri, 8 Jan 2021 04:32:08 -0500

> On Jan 8, 2021, at 3:50 AM, William Park <opengeometry@yahoo.ca> wrote:
> 
> I don't know if it's a bug.  Manpage says "local" builtin takes all the
> options that "declare" takes.  But, "local -p var" doesn't print
> anything, where as "declare -p var" does.
> 
> f1()
> {
>    local a=123
>    local -p a
> }
> 
> f2()
> {
>    local a=123
>    declare -p a
> }
> 
> f1    # prints nothing
> f2    # prints $a

Please specify your version of bash when posting to these lists.
According to the NEWS file, bash 5.1 behaves as you expect:

    y. `local' now honors the `-p' option to display all local
        variables at the current context.

https://git.savannah.gnu.org/cgit/bash.git/tree/NEWS#n79

vq



reply via email to

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