What is bash in Unix/Linux

Bash is the abbreviation of Bourne Again Shell. It is the default standard shell of linux (also known as the system kernel). Bash is also a common shell script interpreter on Unix/Linux. Since bash is a standard shell, there are non-standard shells. sh, csh, ksh, etc. We often talk about how many kinds of shells there are. In fact, we are talking about shell script interpreters. Shell is a scripting language. Then, there must be an interpreter to execute these scripts. bash is created based on the Bourne shell. , and absorb some features of C shell and Korn shell, and bash is fully compatible with sh, that is, scripts written in sh can be executed in bash without modification.

  sh: Developed by Steve Bourne, sh is the abbreviation of Bourne Shell, sh is the default shell of the Unix standard.

  ash: ash shell is written by Kenneth Almquist, a small shell that occupies the least system resources in Linux, it only contains 24 internal commands, so it is very inconvenient to use.

  csh: csh is a relatively large kernel of Linux. It is compiled by a total of 47 authors represented by William Joy, and has a total of 52 internal commands. The shell actually points to a shell such as /bin/tcsh, that is to say, csh is actually tcsh.

  ksh: ksh is an acronym for Korn shell, written by Eric Gisin, and has a total of 42 internal commands. The biggest advantage of this shell is that it is almost completely compatible with the commercial distribution of ksh, so that you can try the performance of the commercial version without paying for the commercial version.

Now we know that there are many kinds of shells on Unix/Linux, so how do I know which shell is currently in use, we can view this information from the current process.

Method 1: ps | grep $$ | awk '{print $4}'
Method 2: echo $0
Method 3: echo $$ | ps -p

$$ indicates the process number of the shell.

Similarly , the specific path of the shell that the user can log in is recorded in the /etc/shells configuration file. All types of loginable shells used in the current system, so by viewing the contents of this file, you can know all types of shells supported in the current system.

When you want to check the shell type of a user, you can check the login shell type of a specific user in the last field of the /etc/passwd file. Taking root as an example, execute cat /etc/passwd | grep ^root The last : field displays the login shell type of the root user, which is bash

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325890420&siteId=291194637