Cu Play Shell 13 question: What is shell

xiaoxiao2021-03-06  66

On the first question, what is the shell Author: Rick Rummel describes the many things you can do without having to know how they actually work. For example, you don't have to know how to use the physical principle of engine combustion. Lack of electronic knowledge will not prevent you from listening to music with CD. I don't know what shell and its working principle, you can still use UNIX. However, you know that you can better utilize UNIX. A UNIX system has three representative shells available: Bourne Shell, Korn Shell, C shells. They will be discussed at 11, 12, 13. In this chapter, you will learn: What is the shell shell to do what shell and the relationship between the entire system protect its internal core with Shell nuts, and a UNIX Shell provides a peripheral protection layer. When you start a UNIX-based computer, UNIX programs are transferred to the computer's memory until you are shut down. This program is called kernel, which performs many underlying and system levels. The kernel has a responsibility to explain the basic instructions and send them to the processor. The kernel is also responsible for running and scheduling processes, as well as performing all input outputs. The kernel is the heart of the UNIX system, and there is only one inner core. You may have a bit confusing to kernel duties, while kernel instructions are the same complexity and high technical. In order to protect the kernel's complexity, it is also a housing (shell) around the kernel to protect the kernel to protect the kernel to prevent the kernel. The user makes a request to the shell, the shell explains and transmits the request to the kernel. The remaining part of this section explains how this outer layer is established. Once the kernel is transferred into memory, he is ready to execute the user's request. However, the user first has to connect to the login and issue a request. Anyway, the user logs in, the kernel must know who the user and how to talk to him. To do this, the kernel calls two special programs, getty and login. Corresponding to each user's login point - commonly referred to as a TTY-core calling Getty program. This process is called spawning (spawn is a spawning). GETTY displays a login prompt, which continuously monitors the input point waits for the username. When getty gets any input, it calls the Login program. Login establishes the user's identity and verifies the right to log in. The Login program checks the Password file. If the password entered by the user is incorrect, the control will return from the login point to getty. If it is correct, login calls the program recorded in the user entry in the Password file and gives the control to it. This program may be a word processing software or a spreadsheet program, but generally known as the shell program. It is assumed that there are four users already log in into the system. Among these four users, there are two Bourne Shells, one uses the Korn Shell, and has a spreadsheet program. Every user gets a copy of the shell to serve its request, but only one in the kernel. Using Shell does not hinder the user using spreadsheets or other programs, those programs are running under the active shell. Shell is a single user-specific program that provides an interface between the user and the UNIX kernel. You don't have to use the shell to access UNIX. In the above example, a user replaced the shell using a spreadsheet. When this user logs in, the spreadsheet program starts. When it exits the spreadsheet program, he exited the system. This technology is useful when emphasizing security or hoping that users are shielded with any UNIX interface. Disadvantages is that users cannot use Mail or other UNIX features. Because Login can perform any program - SHELL is just a simple program - you may write your own shell.

In fact, three independent development shells have become part of UNIX standards. They are: Bourne Shell, developed by Stephen Bourne, developing C shell by David Korn, develop shell's diversity of shell to make you choose the most suitable for you or you feel closest. Shell's feature However, which standard shell you choose does not have a lot of relationships, because three shells have the same purpose: provide an interface for users under UNIX. In order to achieve this goal, three shells provide the same basic function: command line interpretation function startup program input / output redirect pipe connection file name replacement variable maintenance environment Control SHELL programming line explanation When you log in, start a interactive When you have shells, you will see a shell prompt, usually the form of $,% or # symbols. When you knock in a row of characters at the prompt, the shell tries to explain it. The input under the shell prompt is sometimes referred to as a command line. The basic format of the command line is the Command Arguments command name parameter (one or more)) Command is the executable UNIX command, the program, utility, or shell program. Arguments is passed to the executor. Most UNIX utilities require the following format: Option FileNames Options file name (one or more)), an example, $ ls -l file1 file2 in the command line There are three parameters in this command line to pass to Ls, the first is an option, and the remaining two is the file name. One of the things that shell makes the kernel is to reduce unwanted information. For computer, blank (Whit-espace) is a class of useless information; therefore, it is necessary to know what shell has done when you encounter a blank. Blank consists of spaces, horizontal tabs, and liftrs. Consider this example: $ Echo Part A Part B Part C Part A Part B PART C This explained that the command line is the echo command with six parameters and delete the blank between the parameters. Suppose if you are printing the header wants to keep blanks, you have to enclose the data using quotation numbers as shown below: $ Echo Part A Part B PART C Part A Part B PART C Single quote Block SHELL from checking quotes. Now shell interprets this line as an echo command with a parameter, and this parameter is exactly the blank string. Startup program When the shell explains the command line, it launches the program required by the command line. Actually, the kernel is executed. In order to start the program, SHELL searches executables in the directory specified by the PATH environment variable. When it finds this file, start a child shell to run the program. You should know that the SHELL does not have to affect its father's environmental settings to establish and manipulate your own environment. For example, a child shell can change its working directory. After it is running, its parent shell's working directory remains unchanged. The input and output redirects will redirect before executing the program. Consider the following examples, where WC Word Statistics Tool Statistics There are five lines of data files: $ WC -L FIVELINES 5 FIVELINES $ WC -L 5 There is a little bit difference. In the first example, the WC knows that it should go out to find a file called FiveLines and operate it. Because the WC knows the file name, it displays it to the user.

转载请注明原文地址:https://www.9cbs.com/read-90697.html

New Post(0)