Reading about this question: In zsh how can I list all the environment variables?In zsh how can I list all the environment variables?, I wondered, how can I list all the shell variables?
Also, does the distinction between shell variables and environment variables apply to shells other than zsh?
I am primarily interested in Bash and Zsh, but it would be great to know how to do this in other mainstream shells.