[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
test_v doesn't work for associative arrays
From: |
pskocik |
Subject: |
test_v doesn't work for associative arrays |
Date: |
Fri, 10 Jun 2016 14:53:23 +0200 (CEST) |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: 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../. -I.././include -I.././lib -D_FORTIFY_SOURCE=2 -g
-O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -Wall
uname output: Linux laptop 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22
09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.3
Patch Level: 11
Release Status: release
Description:
[Detailed description of the problem, suggestion, or complaint.]
Repeat-By:
#!/bin/bash
declare var
declare -a ary
declare -A asoc
var=1
ary=(1)
asoc[a]=1
for a in var ary asoc; do
printf '%s\t' "$a"
if test -v "$a"; then
echo â
else
echo â
fi
done
<<OUTPUTS
var â
ary â
asoc â
OUTPUTS
Fix:
[Description of how to fix the problem. If you don't know a
fix for the problem, don't include this section.]
- test_v doesn't work for associative arrays,
pskocik <=