I am having two scripts: parent and child.
>>cat fake_parent.sh
#!/bin/sh
my_child(){
echo "I am parent "
./fake_child.sh
}
>>cat fake_child.sh
#!/bin/sh
echo "I am child"
echo "I want to know my parent ...i.e fake_parent.sh here"
I am sourcing fake_parent.sh
and calling my_child
function; which should print "fake_parent.sh" at the end of the echo
command. I have tried $BASH_SOURCE
and $0
but both are giving me "fake_child.sh"
Please help.