[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Array variables still seen by test -v as unset even after assignment
From: |
dtr |
Subject: |
Array variables still seen by test -v as unset even after assignment |
Date: |
Tue, 26 Jul 2016 20:29:31 +0300 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I./include -I. -I./include -I./lib
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
-DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin'
-DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout'
-DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -march=corei7-avx -O2 -pipe
-fomit-frame-pointer
uname output: Linux home 4.0.5-gentoo-i5 #11 SMP PREEMPT Thu Dec 31 00:13:56
MSK 2015 x86_64 Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz GenuineIntel GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.3
Patch Level: 39
Release Status: release
Description:
Unlike usual variables, that have been assigned an empty value, arrays
are treated by test -v as if they werenât assigned anything.
Repeat-By:
$ unset nothing; declare -p nothing; [ -v nothing ]; echo $?
bash: declare: nothing: not found
1
$ unset var; var= ; declare -p var; [ -v var ]; echo $?
declare -- var=""
0
$ unset arr; arr=(); declare -p arr; [ -v arr ]; echo $?
declare -a arr='()'
1
- Array variables still seen by test -v as unset even after assignment,
dtr <=