I thought I might have misunderstood your question, because what you seem to be asking for is pretty much the way most everyone operates anyway. We use an interactive shell for, well, interaction. But we expect that scripts are often run by a different shell.
This typically "just works", since the vast majority of the scripts you will execute will include a shebang line. That way the script itself can request the interpreter closest to the feature set it needs. If it needs POSIX compatibility, it should specify either:
That may be
dash (on Debian/Ubuntu flavors), or it could be BusyBox's
ash (on Alpine), or something else. It's up to the distribution itself to make
sh point to the most POSIX compliant shell that it provides by default. In the distant past, in some (most?) cases, this was even
In the rare event that someone leaves out the shebang, well, be suspicious of the rest of the code-quality for starters. But running it isn't a problem -- Just
But no one expects you to actually operate interactively under today's basic shells interactively. Personally, I use
fish, which is the furthest of the ones you mentioned from any form of POSIX compliance. But I can write my scripts in
fish (preferably, since it has a much more modernized scripting language) or POSIX, if I need portability. And it doesn't matter, since it's the shebang that handles that.
The one area where this isn't the case is for scripts that need to be sourced, since they change the environment of the current shell instance. These do not get executed with the shebang-specified interpreter, but are executed by the interactive shell itself. I rarely find this to be a problem myself, since most all of the software that I use provides a
fish config file if needed. But in those rare instances when you really do need to source a POSIX file, there are utilities such as bass and others to help you do this.
zsh, this isn't even a problem, since most all config files are written to a lowest-common-denominator that they can be sourced in the "close-enough-to-POSIX-to-not-matter" Zsh and bash.