Skip to content

Latest commit

 

History

History

funcname-function-name

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

$FUNCNAME function name

To know the current function name, we must set it manually for POSIX, and we prefer to use the environmen variable $FUNCNAME because it matches the automatic Bash environment variable $FUNCNAME.

To make the code compatible on POSIX and Bash:

foo() { 
    FUNCNAME=${FUNCNAME:-foo}
    echo "$FUNCNAME"
}