سؤال

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

هل كانت مفيدة؟

المحلول

You can use $FUNCNAME to do so.

$ toto()
> {
> echo "this function name is $FUNCNAME"
> }
$ toto
this function name is toto
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top