I've been searching for a while and haven't found this answer anywhere.
How can I tell which shell is running my script from within the script? For example, I have lots of older scripts that we are porting to a new Linux system. Many of the scripts start with ":" alone on a line, which I think long ago forced /bin/sh.
Is there a way to tell within the script what it's being interpreted by? I tried "ps", but that only shows the name of the script.
I usually use a shebang only when on a system that doesn't have a POSIX shell in /bin/sh or when I need some feature not supported by the standard shell.
I don't have linux in front of me, but most likely it should be a combination of what you do on above with what 'Scrutinizer' suggested previously.
Maybe others could 'port' this to linux for you.