Question

How to dispaly the function name into the function?

#!/bin/sh
toto()
{
    echo "$something"
}

toto

the above code should display

toto

I m using bash linux from busybox

Was it helpful?

Solution

You can use $FUNCNAME to do so.

$ toto()
> {
> echo "this function name is $FUNCNAME"
> }
$ toto
this function name is toto
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top