How To Get Shell Type and Version?
While using remote sessions we may need to know the type and version of the remote shell . Bash is popular but there may be different shells like sh, csh, ksh etc.
Using $SHELL Variable
Shells provides environment variables to give information about the shell and the environment. $SHELL environemnt variable can be used to get current she type. $SHELL variable information is not so reliable.
$ echo $SHELL
We can see that our current shell is bash
Using Ps Command
We can use ps command with some parameters to get shell information like below.
$ ps -p $$
PID TTY TIME CMD
3380 pts/8 00:00:00 bash
- We use ps command by providing current process