I have successfully been able to call a single array as a parameter, but I am having trouble passing through multiple arrays. Here is what I have so far:
callin
Characters in the third array have special meaning, in bash, two first arrays could be passed & printed like this:
#!/bin/bash
called_function()
{
local local_array1=$1[@] # i am guessing my problem lies here?
local local_array2=$2[@]
echo ${!local_array1}
echo ${!local_array2}
}
calling_function()
{
array1=(1, 2, 3, 4)
array2=(a, b, c, d)
called_function array1 array2 #array3
}
calling_function
produced this:
./test.sh
1, 2, 3, 4
a, b, c, d