bug-bash
[Top][All Lists]
Advanced

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

Using variables in variables names


From: Dirk H. Schulz
Subject: Using variables in variables names
Date: Mon, 13 Mar 2006 21:52:34 +0100
User-agent: Mozilla Thunderbird 1.0.7 (Macintosh/20050923)

Hi folks,

I am sure this has been asked quite some times, but I did not find anything inspiring or helpful - in fact not too much at all.

For accelerating a script I need the possibility to set up an unknown number of arrays and to name them (at least partly) with values of a variable. It is like defining arrays with names that contain an increasing number: array$x.

While poking around I found out: This does not work at all, even with simple variables it does not.

dings=bums
echo $dings
bums
ac=12  dings$ac=wasannersder
-bash: dings12=wasannersder: command not found


I looked very deeply into man bash and any manual and howto I found, but did not find out any reason why this does not work. It must be one of the basic principles of expansion and assignment, but I would like to understand it.

And then the question of multi-dimensional arrays (see above). The "Advanced Bash Scripting Guide" mentions that it is possible to have them using indirect referencing - but I did not understand how this could be done.

Any idea, hint or help? It would be a great relief after two days of search and research.

Dirk






reply via email to

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