|
Array inside an array
hi All,
I have a array as follows,
array1=("xx" "abc" "def" "xyz")
and each array1[index] is also storing some array values, like
array1[1]=abc
and abc=("a" "b" "c") etcetera etcetra.........
Note : each subarray under array1 have index 3 i.e. it can max contain 3 values
if i echo ${abc[index]} [ where index is 1,2,3...] it works fine.
but if i loop thru it's not printing the values, can anybody help me solving this thru loop,
my loop goes like this
cnt=1
total_Array=${#array1[*]}
no_loop_thru=${#abc[*]}
while [ $cnt -lt $total_Array ]
do
srch_fld=`echo ${array1[$cnt]}`
j=1
while [ $j -le $no_loop_thru ]
do
#var1=`$srch_fld[$j]`
#echo ${var1}
echo ${srch_fld[$j]}
j=`expr $j + 1`
done
cnt=`expr $cnt + 1`
done
can anybody suggest any improvement on this......LOOP
|