Three ways to execute shell scripts

Source: Internet
Author: User

1. Bash script or SH script

2,./script

3,. Script or source script

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/6C/wKiom1UIOtqyKgSsAADRgwmwoFU423.jpg "title=" QQ picture 20150317223121.jpg "alt=" Wkiom1uiotqykgssaadrgwmwofu423.jpg "/>

Description. Or source is a built-in command

The first method is to use the script when it does not have permission to execute

The second method is to execute the script under the current path but must have a row permission

The third method runs under the current process, which is the parent process, while the first two methods create a child process under the parent process to run the script

Give a small example to show the difference:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/6C/wKiom1UIPMTyk5fLAAFS3Gq_lSA179.jpg "title=" QQ picture 20150317223936.jpg "alt=" Wkiom1uipmtyk5flaafs3gq_lsa179.jpg "/>


Because the first two execution script methods are to create a child process under the current parent process to execute the Shel script, the defined content is not returned to the parent process, and the third method is to execute the script directly under the parent process, which can return the defined content.

Vim/etc/init.d/crond

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/66/wKioL1UIPyPTfsNXAAHBsUIZtKk357.jpg "title=" QQ picture 20150317224454.jpg "alt=" Wkiol1uipyptfsnxaahbsuiztkk357.jpg "/>

We generally use the. Load function library, because the following statement calls a function or variable in the library, and if we use SH, we will not be able to call functions or variables in the library.









This article is from the "Learning Path to Linux" blog, so be sure to keep this source http://2845621599.blog.51cto.com/8221220/1621627

Three ways to execute shell scripts

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.