No, the functions have to exist in the shells environment at the time of calling them.
Google's "Shell Style Guide" has a fix for this:
A function called
main is required for scripts long enough to contain at least one other function.
At the very end of the script, after all functions, as the only statement not in a function, you would have
This would call the
main function with whatever parameters the script was given. The
main function could be located at the top of the script (the style guide says to put it at the bottom, but then again, it says many things).
When the shell gets to the
main call, all functions in the script have been parsed and can therefore be called from within the