Link to home
Start Free TrialLog in
Avatar of simulant
simulant

asked on

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...
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial