对我来说很好.
declare -a FUNCTION
FUNCTION[1]="FUNCTION.A"
FUNCTION[2]="FUNCTION.B"
FUNCTION[3]="FUNCTION.C"
#Define one of the functions
FUNCTION.A() { echo "Inside of FUNCTION.A"; }
$ for i in "${!FUNCTION[@]}"; do ${FUNCTION[$i]}; done
Run Code Online (Sandbox Code Playgroud)
OUTPUT:
Inside of FUNCTION.A
FUNCTION.B: command not found
FUNCTION.C: command not found
Run Code Online (Sandbox Code Playgroud)