array arguments in ksh

I'm writing a general function to process an array of strings, and I want that function to be able to receive the array as an argument.  Simple enough, right?  Well, given the following:

###########
function testit {
  echo $1 $2 $3
}

a[0]="hello world"
a[1]=goodbye

testit ${a[*]}
###########

this outputs:
hello world goodbye

Is there a way to pass in the *actual* array, and not the array elements joined by spaces?  I want to be able to recreate the array in the function, but the korn shell is a bit limited here...unless I'm missing something??

Thanks...
simulantAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ahoffmannConnect With a Mentor Commented:
> Is there a way to pass in the *actual* array, and not the array elements joined by spaces?
AFAIK not with ksh

>  I want to be able to recreate the array in the function,
the array has to be a global variable
0
All Courses

From novice to tech pro — start learning today.