I’d like to get the function name from within the function, for logging purposes.
KornShell (ksh) function:
foo ()
{
echo "get_function_name some useful output"
}
Is there anything similar to $0, which returns the script name within scripts, but which instead provides a function’s name?
If you define the function with the
functionkeyword, then$0is the function name:(Tested in pdksh.)