Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15903

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

From pepa65 <solusos@passchier.net>
Newsgroups gnu.bash.bug
Subject Re: test -v for array does not work as documented
Date 2020-02-19 23:52 +0700
Message-ID <mailman.1178.1582131194.2412.bug-bash@gnu.org> (permalink)
References <w6ga75e23e8.fsf@kph.uni-mainz.de> <c8e8a1f7-26f3-a189-8f02-562632597849@case.edu> <umu9ek0u1@kph.uni-mainz.de> <58c60b7b-cad9-df7a-7871-e739f23c060c@passchier.net>

Show all headers | View raw


On 19/02/2020 23.18, Ulrich Mueller wrote:
> So, is there any syntax that allows to test if a value has been assigned
> to the array variable? Especially, to distinguish VARNAME=() (empty
> array) from VARNAME being unset?

Not `test` as such as we have just learned, but the returncode of
`declare -p VARNAME` will be different for VARNAME being unset or being
set to `()` or `""`. Add `&>/dev/null` to taste..!

Peter

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: test -v for array does not work as documented pepa65 <solusos@passchier.net> - 2020-02-19 23:52 +0700

csiph-web