You can always just try to execute a function. If it does not exist, the exit status of the command will be 127:
$ myfunction arg1 arg2 || { > if [ $? -ne 127 ]; then > echo Error with my function > else > echo myfunction undefined > fi; }
Of course, a function may have the same name as another binary, and you cannot run this program if it is not obscured by the function.
source share