You seem to be expecting the shell to generate some kind of anonymous array variable - AFAIK that's not possible in bash
.
The simple approach is to pass individual arguments (which may contain whitespace, if properly quoted) and then refer to them with "$@"
myfunc ()
{
group=("$@");
for i in "${group[@]}"
do
printf "%s\n" "$i"
done
}
then for example
$ myfunc "one nine" "two" "three four five"
one nine
two
three four five
although in this particular case I don't see any benefit of the additional array variable - you may as well just loop over "$@"
directly:
myfunc ()
{
for i in "$@"
do
printf "%s\n" "$i"
done
}
If you just want it to "look like an array" in the calling context, then the only way I can think to do that would be to pass it as a string e.g. myfunc '("one nine" "two" "three four five")'
and then eval
the assignment inside your function eval group="$1"
but I do not recommend doing that.