Differences between source, sh, bash, and./script execution in ubuntu

Source: Internet
Author: User
Differences between source, sh, bash, and./execution scripts in ubuntu source command usage: sourceFileName function: read and execute commands in FileName in the current bash environment. This filename File may not have the & quot; execution permission & quot; Note: this command is usually replaced by the command .... Differences between source, sh, bash, and./execution scripts in ubuntu source command usage: source FileName function: read and execute commands in FileName in the current bash environment. This filename File may not have the "execution permission" Note: this command is usually replaced by the "." command. For example, source. bash_profile www.2cto.com.. bash_profile is equivalent to both. The source (or vertex) command is usually used to re-execute the modified initialization document. The source Command (from the C Shell) is the built-in command of the bash shell. The Dot Command is a dot symbol (from the Bourne Shell ). The main body of the source program is bash, and the value of the $0 variable in the script is bash. because it acts on the current bash environment, the set variable in the script will directly take effect.
2 sh, bash command usage: sh/bash FileName function: open a sub-shell to read and execute the command in FileName. This filename File may not have the "execution permission" Note: when running a shell script, another command interpreter is started. each shell script runs effectively in a sub-process of the parent shell (parent shell. this parent shell refers to a process that provides command indicators to you on a control terminal or in an xterm window. shell scripts can also start their own sub-processes. these sub-shells (that is, sub-processes) allow scripts to run multiple sub-tasks in the script in parallel and efficiently. in ubuntu, sh is just a link to bash. Because www.2cto.com is executed in the sub-shell, the variables set by the script do not affect the current shell.
3../command usage:./FileName function: open a sub-shell to read and execute the command in FileName. The filename File requires "execution permission". note: when a shell script is run, another command interpreter is started. each shell script runs effectively in a sub-process of the parent shell (parent shell. this parent shell refers to a process that provides command indicators to you on a control terminal or in an xterm window. shell scripts can also start their own sub-processes. these sub-shells (that is, sub-processes) allow scripts to run multiple sub-tasks in the script in parallel and efficiently. because it is executed in the sub-shell, the variables set by the script do not affect the current shell. Author Tender001
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.