bug-bash
[Top][All Lists]
Advanced

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

Re: Indirect expansion and arrays


From: Mart Frauenlob
Subject: Re: Indirect expansion and arrays
Date: Wed, 08 Dec 2010 15:49:57 -0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6

On 29.07.2010 22:55, Bernd Eggink wrote:
It seems that indirect expansion doesn't work with arrays:

$ a=(x y z)
$ b=a
$ echo "${!b[0]} ${!b[1]} ${!b[2]}"
x

Is that intended? The documentation isn't explicit about it.

IMHO it would be very desirable to have a indirect expansion facility
for arrays. Otherwise there is only a choice between passing all
elements to a function, which is time-consuming, or using eval, which is
cumbersome and error-prone.



yes, that would be nice - as a feature.
but it somehow conflicts logically with ${!array[@]}, which returns the indicies of an array (some ksh derivied feature I think).


reply via email to

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