Shell Command Execution

Source: Internet
Author: User

Shell Command Execution 1. shell commands include built-in commands and external commands. Built-in commands are built-in by shell interpreter. They are directly executed by shell and do not need to derive new external commands of the process. These commands are binary code and shell script. 2. www.2cto.com (1) to execute external binary commands, a mechanism is required to allow sub-processes to be converted to commands to be executed. Unix/Linux calls exec to do this. It allows a process to overwrite itself with executable code of other commands. Binary code needs to be loaded into memory by the disk. The shell interpreter calls a copy of fork itself, and then uses the exec series functions to execute External commands, so that the external commands Replace the current fork sub-shell. (2) The execution of shell scripts is slightly different from that of binary files. For shell scripts, the shell interpreter fork a sub-shell program, and the sub-shell program will check the first line of the script (such #! /Bin/bahs), find the interpreter used to execute the script, and then load the interpreter to execute the script program. The program is obviously a sub-process of the current shell. If this interpreter is the same shell as the current shell, such as bash, It is the subshell of the current shell, and all the commands in the script are executed in the subshell environment, does not affect the current shell environment.

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.