I would like to use array name as variable and pass it to my function. I'm trying something like this:
array_one=(a b c d)
array_two=(1 2 3 4)
function myfunction() {
echo "${$1[*]}"
}
myfunction array_one
myfunction array_two
I expect result:
a b c d
1 2 3 4
I'm getting error "bad substitution". Obviously this line is bad:
echo "${$1[*]}"
How to do it properly?