Can there be multi-dimensional variable arrays in borne shell?

Hello -

I've serached the web but can't find much on array script variables (except that C-shell variables are arrays!)

I'm trying to form a 2-D string array: (this is what I want, but in java)

String[][] list = { {"one", "two"}, {"three"} };

I know this is a 1-D string array shell variable:

list="one two"

but how can I get another dimension? (and then index them in borne shell?) (I acknowledge that it might not be possible)

Basically I'd like to have a single variable, it's first set of elements always get evaluated, and if a 2nd dimension exists, apply slightly different logic on all of the other elements.

Any ideas would be greatly appreciated.

Thanks, Sean

I'm afraid you might have to build such array through logic, at least in Korn Shell (ksh).

As you mentionned, here's what's truly available:

# Arrays : one dimensional arrays of integers or strings
# automatically dimensionned to 1024
animal[0]="dog" ; animal[1]="horse" ; animal[3]="donkey"
set -A flower tulip gardenia " " rose
print ${animal[*]}
print ${flower[@]}
print "cell#1 content : ${flower[1]}

Thanks so much -
It appears C-shell and K-shell like the [] syntax, but borne doesn't -

hopefully someone else has some ideas?

Cheers-
Sean

If you need arrays you really should consider switching to ksh or bash. If that is really not possible, you can use eval to simulate arrays but the syntax and quoting concerns are nasty....

# simulate a[index]=string
index=5
eval a${index}=string

What this really did of course is create a vaiable called a5 which got the value. But you also could have an a4 variable and so on.

# simulate echo ${a[index]}

eval echo \$a${index}

# simulate x=${a[index]}

eval x=\$a${index}

Thanks a lot - I know it looks nasty but it does what I wanted -
atleast I'm learning a bit more.

Cheers -

Sean