Consider the following sample scripts.....
filename: f1
# Call f3
f3
filename: f2
# Call f3
f3
filename: f3
# f3
echo "$x called me"
*** Where "x" is the name of the script file that called function 3 (f1,f2, ...,fn).
*** I can pass it as a variable ($0, $BASH_SOURCE) from f1 & f2 scripts.
*** But i don't want to modify f1 & f2 (lot of files are using it !!!)
How can i modify f3 alone to make it print the name of the calling script file ?