4 ways to identify your current shell (if it’s bash)
Introduction Knowing which run you are using on your system is an important piece of information. Your shell determines your login environment to a large extent as it controls which environment variables get exported, your shell prompt etc. On a Linux system it’s almost certain that you will using the bash shell unless the system administrator has deliberately changed it to something else. In this quick article we will demonstrate four ways you can determines if you are running the bash shell or not. Method 1: Use the BASH environment variable If you are currently using the bash shell then the BASH environment variable will contain the path of the bash shell installed on your system. If you are using a different shell then this variable will be empty. Let’s try this on the command line. [root@nclient ~]# echo $BASH /bin/bash The above output shows the path where bash is installed on my system. Now let’s change the shell and then try again. [root@linuxnix ~]# zsh [root@linuxnix]~# echo $BASH [root@linuxnix]~# When I changed my shell to zsh and then checked the value of the variable $BASH it came out to be empty indicative of the fact that I’m no longer running the bash shell. Method 2: use the SHELL environment variable The SHELL environment variable contains the path of the shell that is set when you log...
Read More