given array arr
and string str
. If I send them to function in the next way:
func "${arr[@]}" ${str}
How can I define the array and the string in func
function?
function func {
local arr=....
local str=....
}
according to what I understood (It's correct?) if I will do: local arr=("$@")
I will get that:
arr[0]=the first argument - in this case it's will be all the array
arr[1]=str
(according to my checks local arr=("$@")
gives array exactly like arr (what that I sent) , apart of it's adds str
as a last element in this array..)
[I don't ask for "how to send array in bash", but, how can I choose the array from all the arguments]