Topic: How to test what shell I'm using in terminal?

Is there an easy way to determine what shell I'm using in terminal?

Share

Re: How to test what shell I'm using in terminal?

I've found several ways, from most to least reliable. The following works in the four shells I have installed on my system (bash, zsh, csh, tcsh):
1)

# ps -p $$
  PID  TT  STAT      TIME COMMAND
14143   0  Ss     0:00,03 -bash (bash)

2)

# echo $0
-bash

3) Check $SHELL; this is a last resort, as it specifies your default shell and not necessarily the current shell.

# echo $0
csh

# echo $SHELL;
/usr/local/bin/bash