I have a bash function that reads a csv file and I want that function to return an array. How do I do that?
I know that typically bash does not "return objects" but I wonder if there's a hack so that the following code:
data=$(readFromCSV $file)
returns an array from the custom function readFromCSV. And I mean $data being a true array so I could for instance run
echo {#data[@]}
and it would tell me how many items are in the array.
how would you tell the function to return the array?
thanks
bash. There is only array syntax that lets you treat a single name as a collection of separate variables.