There are several ways to see what shell you are currently using, and the easiest way is to use the shell's special parameters.
First, a special parameter named "$$" represents the PID of the shell instance that you are currently running. This parameter is read-only and cannot be modified. So, the following command will also show you the name of the shell you are running:
The code is as follows:
$ ps-p $$
PID TTY Time CMD
21666 PTS/4 00:00:00 Bash
The above commands work in all available shells.
If you don't use CSH, another way to find the shell currently in use is to use the special parameter "$", which represents the name of the shell or shell script that is currently running. This is a special parameter for Bash, but it can also be used in other shells, such as sh, zsh, tcsh, or dash. Use the echo command to view the name of the shell you are currently using.
The code is as follows:
$ echo $
Bash
Don't be fooled by a separate environment variable called $SHELL, which is set to the full path of your default SHELL. Therefore, this variable does not necessarily point to the shell you are currently using. For example, even if you call a different shell in a terminal, the $SHELL remains unchanged.
The code is as follows:
$ echo $SHELL
/bin/shell
So, to find the current SHELL, you should use $$ or $ $, but not $SHELL.
Find the version of the current Shell
Once you know which shell you are using, you may want to know the version of the shell. To do this, enter the shell at the command line and add the "--version" parameter to view the version information later. For example:
For bash Shell:
The code is as follows:
$ bash--version
GNU Bash, version 4.3.30 (1)-release (X86_64-PC-LINUX-GNU)
Copyright (C) 2013 Free Software Foundation, Inc.
License gplv3+: GNU GPL version 3 or later
This is free software; You are are free to change and redistribute it.
There is NO WARRANTY and to the extent permitted by.
For the zsh Shell:
$ zsh--version
Zsh 5.0.7 (X86_64-PC-LINUX-GNU)
For TCSH Shell: $ tcsh--version
The code is as follows:
Tcsh 6.18.01 (Astron) 2012-02-14 (x86_64-unknown-linux) Options Wide,nls,dl,al,kan,rh,nd,color,filec
For some shells, you can also use shell-specific variables (for example, $BASHVERSION or $ZSHVERSION).
The code is as follows:
$ echo $BASH _version
4.3.8 (1)-release