use string as variable name

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

 



Hi,

is it possible to use a string as variable-name?

example:

i=1
img_$i=foo

now i have defined $img_1, but how to display it using $i again?

echo ${img_$i}
echo ${img_${i}}

alternative may be a variable-array, but it seems not possible

img[$i]=bar
img[1]=bar: No such file or directory

i just want to create a dynamic list and access the items of this list by index

another way may be appending new string with separator to existing string and split afterwards,
but then i have the index-problem again.

i know barebox shell is limited (but much more mighty than expected for just a bootloader),
but maybe it is possible :)

any idea?

regards Frank


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux