通过函数名:
if [ "$(type -t func)" = "function" ] ; then echo "func is exists"fi
通过字符串变量:
funcname="func"if [ "$(type -t $funcname)" = "function" ] ; then echo "$funcname is exists"fi
检测函数是否已经定义的话 可以echo你的变量先试一下