Hello,
i have a little problem concerning variable variable names in bash.
I am doing a loop to fill multiple arrays.
if i want to output the arrays, i can, however, do it only one by one; not in another loop.
Quote:
#!/bin/bash
for (( n=0; n<5; n++ )); # create 5 arrays
do
let array$n[0]="432859"
done
echo ${array0[*]} # arrays 0 to 4 can be easily displayed.
echo ${array1[*]} # but i want it as a loop (necessary in mightier programs)
echo ${array2[*]} # and so on...
#this loop does not work.
#line 16: ${array$y[*]}: bad substitution
for (( y=0; y<$n; y++ ));
do
echo ${array$y[*]} |sed s/"533862"/" "/g
done
|
Since i need to loop over the output, so i really only get the lines that where filled, any help is really appreciated!