exec parsing in Shell under Linux

Source: Internet
Author: User

Both exec and source belong to the Bash Internal command (builtins commands), where you can view all the internal command information by entering man exec or man source under bash.
The bash shell commands are divided into two categories: external commands and internal commands.

External commands are implemented through system calls or independent programs, such as SED, awk, and so on.

Internal commands are implemented by a special file format (. def), such as CDs, PWD, etc.


Fork is a system call for Linux that is used to create a subprocess (child process).

A child process is a copy of the parent process that obtains a certain resource allocation from the parent process and the environment that inherits the parent process. The only difference between a child process and the parent process is the PID (process ID).
Environment variables (variables passed to child processes, hereditary is the fundamental difference between local variables and environment variables) can only be passed from the parent process to the child process in one direction. Regardless of how the environment variable of the child process changes, the environment variables of the parent process are not affected.

Two methods of executing shell scripts
One is to create a new shell, and then execute the corresponding shell scripts;
The usual script file (. sh) is this usage. This method first enables the new Sub-shell (the new child process) and then executes the command under it.
One is executed under the current shell and no more shells are enabled.
The source command under Linux no longer produces a new shell, but executes all commands under the current shell

exec parsing in Shell under Linux

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.