The shell itself is a program written in C, which is a bridge for users to use Unix/linux, and most of their work is done through the shell. the shell is both a command language and a programming language. as a command language, it interprets and executes user-entered commands interactively, and as a programming language, it defines variables and parameters and provides many control structures in high-level languages, including loops and branches.
Although it is not part of the Unix/linux system kernel, it invokes most of the functionality of the system core to execute programs, create files, and coordinate the operation of individual programs in a parallel way. Therefore, for the user, the shell is the most important utility program, in-depth understanding and proficiency in the shell characteristics of the extremely use of the method is the key to good unix/linux system.
It can be said that the proficiency of the shell is a reflection of the user's proficiency in the use of unix/linux.
shell has two ways to execute commands:
Interactive (Interactive): Explains the execution of a user's command, the user enters a command, and the shell interprets the execution of a single rule.
Batch: The user writes a shell script in advance, with a number of commands that allow the shell to execute the commands at once without having to hit the command one at a time.
Shell scripts are similar to programming languages, and there are variables and process control statements, but shell scripts are interpreted and do not need to be compiled, and the shell program reads and executes the commands from a single line of script, which is equivalent to a user knocking a line of commands from the script to the shell prompt for execution.
The common shell scripting interpreters on Unix/linux include bash, sh, csh, Ksh, and so on, which are used to call them a shell. We often say that there are many kinds of shells, actually speaking of shell script interpreter.
Bash
Bash is the default shell for the Linux standard, and this tutorial is based on bash. The bash was completed by Brian Fox and Chet Ramey, a bourneagain shell abbreviation with 40 internal commands.
Linux uses it as the default shell because it has features such as the following:
You can use the functions of doskey like DOS to view and quickly enter and modify commands with the arrow keys.
A command that begins with a string is automatically given by finding a match.
Contains its own Help function, you can just type help below the prompt to get related assistance.
Sh
SH was developed by Steve Bourne and is the abbreviation for the Bourne Shell, which is the default shell of the UNIX standard.
Ash
The ash shell was written by Kenneth Almquist, a small shell that occupies the least system resources in Linux, and it contains only 24 internal commands, making it inconvenient to use.
Csh
CSH is a Linux-based kernel that consists of 47 authors, represented by William Joy, and has 52 internal commands. The shell is actually a shell that points to/bin/tcsh, which means that csh is actually tcsh.
Ksh
ksh is an abbreviation for the Korn shell, written by Eric Gisin, with a total of 42 internal commands. The biggest advantage of the shell is that it is almost completely compatible with the ksh of the commercial distribution, so you can try out the commercial version of the performance without having to pay for the commercial version.
> Note: BASH is the acronym for the Bourne Again shell, the default shell for the Linux standard, which is based on the Bourne shell and absorbs some of the features of the C shell and Korn shell. Bash is fully compatible with SH, meaning that scripts written in SH can be executed without modification in bash.
Because the shell appears to be a common feature between UNIX systems and is standardized by POSIX. As a result, shell scripts can be applied to many systems once they are "written attentively". Therefore, the reason to use shell scripts is based on:
Simplicity: The shell is a high-level language through which you can express complex operations succinctly.
Portability: Using POSIX-defined features, scripts can be executed on different systems without modification.
Easy to develop: a powerful and 妤 script can be completed in a short period of time.
However, given the command restrictions and efficiency of shell scripts, the following situations do not typically use the shell:
-
resource-intensive tasks, especially when you need to consider efficiency (such as sorting, hashing, and so on). The
-
Needs to handle the mathematical operations of large tasks, especially floating-point operations, precision operations, or complex arithmetic operations, which are typically handled using C + + or FORTRAN.
-
has cross-platform (operating system) porting requirements (typically using C or Java).
-
Complex applications where structured programming must be used (requiring variable type checking, function prototypes, and so on).
-
is applied to critical tasks that affect the overall system.
-
is a highly demanding task for security, such as requiring a robust system to prevent intrusion, cracking, malicious destruction, and so on. The
-
Project consists of the various parts of a string that depend on it.
-
Requires large-scale file operations.
-
Requires support for multidimensional arrays.
-
Requires support for data structures, such as linked lists or numbers.
-
Requires the creation or manipulation of a graphical interface GUI.
-
Requires direct operating system hardware. The
-
Requires an I/O or socket interface. The
-
Needs to use the interface of the library or old code that is left behind.
-
Private, closed-source applications (shell scripts place the code in a text file that is visible to the world).
If your app fits any of the above, consider a more powerful language-perhaps Perl, Tcl, Python, ruby--, or a higher-level compilation language such as C + + or java. Even so, you'll find that using the shell to prototype your application is also very useful in the development steps.
This article is from the "8159085" blog, please be sure to keep this source http://8169085.blog.51cto.com/8159085/1793154
01. Mountains-some useless nonsense about the shell