[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
declare/typeset can't set array to variable name
From: |
Tim Burnham |
Subject: |
declare/typeset can't set array to variable name |
Date: |
Thu, 4 Jan 2018 21:27:17 -0500 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: darwin17.0.0
Compiler: clang
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='darwin17.0.0'
-DCONF_MACHTYPE='x86_64-apple-darwin17.0.0' -DCONF_VENDOR='apple'
-DLOCALEDIR='/usr/local/Cellar/bash/4.4.12/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DMACOSX -I. -I.
-I./include -I./lib -I./lib/intl
-I/private/tmp/bash-20170916-80428-1663r/bash-4.4/lib/intl
-DSSH_SOURCE_BASHRC -Wno-parentheses -Wno-format-security
uname output: Darwin TimBookPro.local 17.3.0 Darwin Kernel Version
17.3.0: Thu Nov 9 18:09:22 PST 2017;
root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
Machine Type: x86_64-apple-darwin17.0.0
Bash Version: 4.4
Patch Level: 12
Release Status: release
Description:
Declare/typeset throws error when trying to create a new array to a
name held in a variable.
Repeat-By:
tim@TimBookPro:~/ declare var1=( This works )
tim@TimBookPro:~/ var2=var3
tim@TimBookPro:~/ declare ${var2}="And this works"
tim@TimBookPro:~/ declare ${var2}=( This breaks )
-bash: syntax error near unexpected token `('
tim@TimBookPro:~/ declare -a ${var2}=( array flag doesnt matter )
-bash: syntax error near unexpected token `('
- declare/typeset can't set array to variable name,
Tim Burnham <=