[Top][All Lists]

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

[Bash 4.4.5] Variable indirection, error on empty variable

From: Otenba
Subject: [Bash 4.4.5] Variable indirection, error on empty variable
Date: Sun, 27 Nov 2016 08:07:27 -0500

Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' -DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' -DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -Wno-parentheses -Wno-format-security
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.4
Patch Level: 5
Release Status: release

Performing variable indirection using an empty value causes an error. It didn't in Bash 4.3.

$ reference=1
$ echo ${!indirect} #variable indirection using an unset variable

$ indirect=reference
$ echo ${!indirect} #variable indirection to a variable name
$ indirect=
$ echo ${!indirect} #variable indirection using an empty variable
-bash: : bad substitution

The expected behavior is that the result of an indirection be the same whether the indirect variable is empty or unset.

reply via email to

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