Problems encountered with printing local variables in the new command substitution in bash 5.3

王伟 <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Message-ID <CAPGy_Bbw9bQ9-K7menvWF8S0KaT11e3EW3pCChDL9GLjDjT4aA@mail.gmail.com>
The test code is as follows:

test_case5 ()
{
    echo "test_case5 ret----------"
    local a=1 b=2
    local -n c=a d=b
    local all_var_info=$(local)
    declare -p all_var_info
}

test_case6 ()
{
    echo "test_case6 ret----------"
    local a=1 b=2
    local -n c=a d=b
    local all_var_info=${ local;}
    declare -p all_var_info
}

test_case5
test_case6

The result is that the variable substitution for starting a child process
in the past could produce the printed value, but the new one cannot.

test_case5 ret----------
declare -- all_var_info=$'declare -- a="1"\ndeclare -- b="2"\ndeclare -n
c="a"\ndeclare -n d="b"'
test_case6 ret----------
declare -- all_var_info=""
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.