3

What is the most correct way to pass an array to a function?

view full story
linux-howto

http://unix.stackexchange.com – Consider I have a very large array $large_list, is there a way to write a function that will take the array as an argument? For example: echo_idx_array () { arr="$1" idx="$2" echo "${arr[$idx]}" } What is the usual strategy to do something like that? I tried giving the variable $large_list but it was empty. I am willing to modify the function to adapt it to any change in the argument list. For the record, I am using ksh88, and I am looking for answers as portable as can be. EDIT: So far the best I could come up with is to loop through the array and send each element as an (HowTos)