I believe **you cannot *always* get the current shell's name**, and I think you shouldn't.

On Linux distributions, most users would have `bash` as their login & interactive shell (since `bash` is the default shell on most distros). Some users would set their shell to `csh` (and variants) or to `fish`.

(As other comments and answers explain, finding reliably the shell out of `bash`, `zsh`, `tcsh`, `fish` is already challenging)

But some weird users may set their login shell to something entirely different - a Lisp interpreter, [`scsh`][1], [`es`][2], some scripting language à la Python, or Ocaml, or Perl, etc...- and it is their freedom to do so. Probably, some people are coding their own shell and using it interactively. Even if you found their strange shell, you won't be able to do anything useful of it.

So I guess that you are coding some sourceable file (perhaps generating one) to configure some software. So just explain what you are doing, and code for the common case of `bash` (and perhaps `zsh` & `tcsh`) ....


 [1]: http://scsh.net/
 [2]: https://wryun.github.io/es-shell/