bug-bash
[Top][All Lists]
Advanced

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

Re: test -v for array does not work as documented


From: pepa65
Subject: Re: test -v for array does not work as documented
Date: Sun, 23 Feb 2020 23:36:16 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 23/02/2020 23.27, Chet Ramey wrote:
> On 2/21/20 3:31 AM, pepa65 wrote:
>> By the way, it seems that `local -p var` doesn't work like 'declare -p
>> var` even though `help local` suggests it should.
> 
> How so? Do you mean that declare -p var in a function will show different
> variables?

See this output:

localvsdeclare(){
  local var
  var=42
  unset var
  echo -n '"declare -p var":'
  declare -p var
  echo -n '"local -p var":'
  local -p var
}

localvsdeclare
"declare -p var": declare -- var
"local -p var":

Peter



reply via email to

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