What is my (Unix) shell?

Yesterday, January 25, 2017, I spent an hour or two trying to figure out what the shortest command is on a unix (or Linux) shell (command interpreter) that will tell you WHICH shell you're running. It turns out that the SHELL environment variable only tells you what your DEFAULT shell is, not the current one.

This whole thing is complicated by the differences in shells, and what they do, and their various syntaxes. Here's what I came up with.

The shortest POSIX-compliant command (that I could come up with) that will tell you definitively what shell you're running, without spurious characters, is this (it's 65 bytes):
ps -p $$|sed -n 's/ *[0-9][0-9]*.* -*\([a-zA-Z][a-zA-Z]*\)/\1/p'

It turns out that our sysadmins had a better one. It's 47 bytes:
ps -p $$|tail -1|awk '{print $NF}'|sed 's/-//'

My requirements for these commands are as follows:

As far as how to USE it; that's tricky. You can't embed it in a script, because when you call the script, it will report the NAME of the script that you've run, not the name of the shell. You can't alias the command, because the different shells use different conventions for aliasing. All the shells that I could find DO have a "source" command and they do all behave the same.