bash - return array from function and display contents
Already answered here.
You should do a minimal search in google, because this was the first link returned for "bash return array"
Edit:
In bash, functions don't return values. They can return a status (the same as other programs).
So, if you want to return something, you should use global variables that are updated inside your function.