Name of subscript

I have a script that executes another, so script1 executes script2.

Using the $0 variable inside script2 returns the name of script1.

How can I get the name of script2?

Thanks

Weird. It is working properly when I tried it:

[root@linux ~]# cat a.sh
#!/bin/bash
./b.sh
[root@linux ~]# cat b.sh
#!/bin/bash
echo $0
[root@linux ~]# ./a.sh
./b.sh

Can you post how are you calling script2? And how are you using $0 inside script2?

I need to realize the difference between: ./b.sh and . b.sh

Completely different results. Thanks!