The main external interface of the operating system is shell. Shell is the outermost layer of the operating system. Shell manages the interaction between you and the operating system: Wait for your input, explain your input to the operating system, and process the output results of various operating systems.
Shell provides communication between you and the operating system. This communication can be interactive (input from the keyboard and get a response immediately) or shell script (not
Mutual. Shell scripts are a string of Shell and operating system commands stored in files. They can be reused. Essentially, shell script is a command line
Make a simple combination into a file.
Shell is basically a command interpreter, similar to command.com in DOS. It receives user commands (such as LS) and then calls the corresponding application. The common shells include standard Bourne shell (SH) and c shell (CSH ).
Interactive Shell and non-interactive shell
In interactive mode, shell waits for your input and runs the command you submit. This mode is called interactive because shell interacts with users. This mode is also very familiar to most users: logon, command execution, and logout. When you sign back, shell is terminated.
Shell can also run in another mode: non-interactive mode. In this mode, shell does not interact with you, But reads commands stored in files and runs them. When it reads the end of the file, shell is terminated.
Shell Type
There are two main types of shells in UNIX:
Bourne shell (including SH, KSh, and bash)
Bourne shell (SH)
Korn shell (Ksh)
Bourne again shell (BASH)
POSIX shell (SH)
C shell (including CSH and tcsh)
C shell (CSH)
Tenex/tops C shell (tcsh)
Bourne shell
The original Unix shell was written by Stephen R. Bourne at the at&t Bell lab in New Jersey in the middle of 1970s.
Bourne shell. Bourne shell is an exchange-type command interpreter and command programming language. The Bourne shell can run
The sub-shell of login shell or login shell (subshell ). Only the LOGIN command can call the Bourne shell as
Login Shell. In this case, shell first reads the/etc/profile file and the $ home/. profile file. The/etc/profile file is all
The $ home/. profile file is the custom environment for the user. Finally, shell will wait to read your input.
C Shell
Bill Joy developed C shell at the University of California in Berkeley in the early 1980s S. It is mainly used to make it easier for users to use interactive functions, and converts the ALGOL-style syntax structure into the C language style. It provides functions such as command history, alias, file name replacement, and job control.
Korn Shell
For a long time, there were only two types of shells for people to choose from. The Bourne shell was used for programming and the C shell was used for interaction. To change this situation, at&t's
Bell lab David Korn developed the Korn shell. Ksh combines all the interactive features of C shell and incorporates the Bourne shell language.
Method. Therefore, the Korn shell is widely used by users. It also adds functions such as mathematical computing, coprocess, and inline editing.
Yes. Korn shell is an interactive command interpreter and command programming language. It complies with POSIX-an international standard for operating systems. POSIX is not an operating system, but
The goal is the application portability standard-crossing multiple platforms at the source program level.
Bourne again shell (BASH)
Bash is part of the GNU program and used to replace the Bourne shell. It is used in GNU-based systems such as Linux. Most Linux (Red Hat, slackware, Caldera) use Bash as the default shell, and bash is actually called when SH is run.
POSIX Shell
POSIX shell is a variant of the Korn shell. Currently, the largest seller of POSIX shell is Hewlett-Packard. In HP-UX 11.0, POSIX shell is/bin/sh, while bsh is/usr/old/bin/sh.
The default shell in each major operating system:
In Aix, It is the Korn shell.
Solaris and FreeBSD use the Bourne shell by default.
The HP-UX defaults to POSIX shell.
Linux is the Bourne again shell.
Shell is a command parser that interprets user-input commands and sends them to the system kernel for execution. In other words, shell is an interface for the user to talk to the operating system. We issue a command to tell the system to execute our command through shell.