How to Check if a Function Is Defined in Bash
To check whether a function exists in Bash, use the type builtin with the -t option. This returns a string identifying what the name is: alias, keyword, function, builtin, or file. Basic Check The simplest approach: if [[ $(type -t f1) == “function” ]]; then echo “f1 is defined as a function” fi This works…
