bug-bash
[Top][All Lists]
Advanced

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

Setting a value to an indirectly named variable


From: Jan Janousek
Subject: Setting a value to an indirectly named variable
Date: 11 Oct 2001 08:16:14 -0700

Hello.

I run bash (GNU bash, version 2.04.21(1)-release
(i386-redhat-linux-gnu)) on Red Hat Linux 7.1 (Linux 2.4.2-2 i686).

I tried to set a value to an indirectly named variable with only
partial success. The following script:

A=X
echo $A=${!A}
$A=xxx
echo $A=${!A}
export -n $A=xxx
echo $A=${!A}

...results in the following output:

X=
./a: X=xxx: command not found
X=
X=xxx

I expected that the third line of the script ($A=xxx) should set the
value xxx to the variable X (the same way as the fifth line (export -n
$A=xxx)) but it resulted into the error "./a: X=xxx: command not
found".

Am I missing something or is this a buggy behaviour?

Thanks.

Jan



reply via email to

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