Shell Interpreter (Study Note IV)

Source: Internet
Author: User

One, Shell interpreter

Shell interpreter, the bridge between the user and the operating system kernel

The shell is between the operating system kernel and the user, is responsible for receiving the user input operation instruction (command), and runs and interprets, passes the action which needs to carry on to the operating system kernel and executes

The shell program acts as a "command interpreter" role in the system.

such as: Cmd.exe in Windows resembles this role, but receives DOS commands

second, the Shell in Linux 2.1. Shell Common Types
    • Bsh: Written by Bell Labs. BSH is the generation of an earlier UNIX shell program that implements the most basic command interpreter functionality and can also be used as a scripting language
    • Csh: is due to the use of C language syntax style and named, in the user's command line interactive interface made a lot of improvements, and added the history, aliases, file name substitution, job-cutting functions, compared to bsh,csh in more suitable for the user to provide command interactive operation
    • Ksh: After BSH and CSH, it combines the functional advantages of both BSH syntax and csh interactivity.
    • BASH: From the name can be seen is the upgrade version of BSH, is a well-known open source software projects, most of the current Linux version (including Red Hat Company's Linux system) use bash as the default shell program when running the shell program, actually run the bash program
    • Zsh: More shell programs that are designed based on interactive operations, integrating the benefits of multiple shell programs such as Bash,ksh
Third, Bash 3.1, the Linux default shell program used

Command file location:/bin/bash file

[Email protected]/]# ls/bin//bin/
[Email protected]/]# ll/bin/1940416:/bin/
3.2. Main functions
    • command history: a feature in bash that is used to improve command input efficiency, allowing users to quickly and repeatedly execute commands that have already been entered, reduce repetitive input work, upward arrow keys, etc.

History can see which commands have been entered

    • command aliases: frequently used complex commands can be defined as short aliases, when the need to execute the complex command, only need to use aliases to complete the corresponding operation, reduce and operation complexity, improve the input efficiency
    • standard input and output and redirection: Linux uses files to describe the hardware, devices, and other resources of the system.
    • Pipeline operations: in a bash environment, provides a mechanism for collaboration between different commands to output the command to the left of the pipe symbol as input to the right command, which can have multiple pipelines in the same line command
Cat Etc/inittab >>/tmp/bootype.txt
cat >> a.txt << fw> fffffffffff> dddddddddd>

Append the contents of the 2 fw to the file A.txt, if the a.txt does not exist, create a

Iv. command Line

General format of the command line:

command word [options] [parameters]

Command word: Simply speaking, in the Linux character interface, the character terminal, can name the completion of specific operations and tasks of the string, can be called "command."    The command only represents the name of the instruction and program that implements a class of functionality. The command word is case-sensitive and is the most important part of the entire command.

[Options]: Adjust the specific functions of the command, determine how the command will be executed, the same command with different options to use, you can get similar but slightly different features.

[Parameters]: Command word processing objects, can be files, directories, folders, users and other content. The parameters can be 0, multiple.

Command-word option arguments are separated by spaces, and extra spaces are ignored

The order of options and parameters can be confused, can be reversed in order, generally does not affect the normal execution of commands, except for special

Shell Interpreter (Study note IV)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.