If I do
sudo zsh, I can tell I am in zsh by examining
Is there an easier way?
echo $SHELL says it's
/bin/sh, because $SHELL is always the default shell, not necessarily the shell that's actually running.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
If I happen to be on some interactive shell, and just want to quickly verify what kind of shell it is, I usually do a
If I'm in zsh, I get
zsh: parse error near `)'
, bash says
bash: syntax error near unexpected token `)'
and dash and ash also reveal their name in this way. I guess that this approach would also work with csh, tcsh and ksh.