|
Question: I often switch on the command line shell. Is there a quick and easy way to find out I'm currently using shell it? Also, how can I find the current version of the shell?
Find Shell version you are currently using
There are several ways to view what you are currently using shell, the easiest way is through the use of shell special parameters.
One special parameters, named "$$" indicates the current PID you are running shell instance. This parameter is read-only and can not be modified. Therefore, the following command will show that you are running shell name:
$ Ps-p $$
PID TTY TIME CMD
21666 pts / 400: 00: 00bash
The above command can operate in all available shell.
If another way you do not use csh, find the current use of the shell is to use the special parameter "$ 0", which represents the name of the currently running shell or shell script. This is a special parameter Bash, but can also be used in other shell, such as sh, zsh, tcsh or dash. Using the echo command to view the name of the shell you are currently using.
$ Echo $ 0
bash
Do not be called a separate $ SHELL environment variable confused, it is set to the full path of your default shell. Thus, this variable does not necessarily point to your use of the current shell. For example, even if you call a different shell in a terminal, $ SHELL remains unchanged.
$ Echo $ SHELL
/ Bin / shell
So find out the current shell, you should use $$ or $ 0, but not the $ SHELL.
Find out the current version of the Shell
Once you know what you are using the shell, you may want to know this shell version. To do this, enter the shell command line and add "--version" argument in the back can see the version information. E.g:
For bash shell:
$ Bash - version
GNU bash, version 4.3.30 (1) -release (x86_64-pc-linux-gnu)
Copyright (C) 2013FreeSoftwareFoundation, Inc.
LicenseGPLv3 +: GNU GPL version 3or later
Thisis free software; you are free to change and redistribute it.
Thereis NO WARRANTY, to the extent permitted by law.
For zsh shell:
$ Zsh --version
zsh 5.0.7 (x86_64-pc-linux-gnu)
For tcsh shell: $ tcsh --version
tcsh 6.18.01 (Astron) 2012-02-14 (x86_64-unknown-linux) options wide, nls, dl, al, kan, rh, nd, color, filec
For some shell, you can also use shell-specific variables (for example, $ BASHVERSION or $ ZSHVERSION).
$ Echo $ BASH_VERSION
4.3.8 (1) -release |
|
|
|