How can I define a function as an element of an array?
I know I can do this:
function array[5](){ echo "you are inside the function"; }
And it is a valid function, in the sense that, the instruction array[5], correctly execute the function.
Unlucky, the function is not listed in the keys of the array, so, echo ${!array[*]} does not return 5 as a key.
For instance, the following code:
array[0]="first"
function array[5](){ echo "you are inside the function"; }
array[7]="seventh"
echo ${!array[*]}
Only returns 0 7.
So, how can I add a function to an array element, so that I can loop over it?