Task handover, different systems, versions, and shells may not be the same. Some time ago to help a friend to engage in centos5.9, ya ya the use of incredibly is sh. It's crazy! Make a brief summary.
View the shell supported by the current system
[Email protected] ~]# Cat/etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
[Email protected] ~]#
Note: You can install other shells yourself. Like Zsh.
View the shell that is currently in use by the system
1. Echo
I like to use the way, but This usage is not supported by all shells.
[Email protected] ~]# Echo
-bash
[Email protected] ~]#
2. Echo $SHELL
The most common command to view the shell, but not to reflect the current shell in real time. For example, you cannot display the child shell that is located.
[Email protected] ~]# echo $SHELL
/bin/bash
[[Email Protected]ode6 ~]#
3. Real-time view of the shell used in the current process
[[Email protected] ~]# PS | grep $$ | awk ' {print $4} '
Bash
[Email protected] ~]#
Or:ps-ef | grep $$ | Grep-v grep | Grep-v PS
(Note: $$ indicates the shell's process number)
4.
When you know the shell, you can view its version:
[Email protected] ~]# bash-version
GNU Bash, version 4.1.2 (1)-release (X86_64-REDHAT-LINUX-GNU)
Copyright (C) Software Foundation, Inc.
License gplv3+: GNU GPL version 3 or later
This was free software; Redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[Email protected] ~]#
Special variables in the shell:
$
The name of the shell or shell script
$*
Give the argument list in pairs of double quotes
[Email protected]
Double quotation marks to return each parameter
$#
Number of parameters
$_
Represents the last parameter of the previous command
$$
PID that represents the command that is located
$!
PID that represents the last executed background command
$?
Represents the exit status after the execution of the previous command
--Ningzhiyuan Experience Summary
This article from the "[email protected]" blog, reproduced please contact the author!
Linux Current Shell Summary!