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=""