Check if a function exists before executing it in shell
ash, function, linux, shell
Solution
As read in this comment, this should make it:
type -t function_name
this returns `function` if it is a function.
Test
$ type -t f_test
$
$ f_test () { echo "hello"; }
$ type -t f_test
function
Note that `type` provides good informations:
$ type -t ls
alias
$ type -t echo
builtin
Problem
I want to check if a function exist or not before executing it in the shell script. Does script shell support that? and how to do it?