Three methods of script execution in linux

Source: Internet
Author: User
There are three methods for executing scripts in linux. /bar. sh is executed in the sub-process of the folk... /bar. sh is. /bar. sh content is read to the current running environment and execute exec. /bar. sh is to replace the current process. /bar. sh process .www.2cto.com false... there are three methods for executing scripts in linux. /bar. sh is executed in the sub-process of the folk... /bar. sh is. /bar. sh content is read to the current running environment and execute exec. /bar. sh is to replace the current process. /bar. sh process. www.2cto.com suppose there is a script foo. sh Python code #! /Bin/sh A = "hello"; echo "before, A is $ ". /bar. sh echo "after, A is $ A" script bar. sh Python code #! /Bin/sh A = "world"; execute foo. sh and the output is www.2cto.com before, A is hello after, A is hello because bar. sh is executed in the child process and does not affect the variables of the parent process. change .. /bar. sh and the output is before, A is hello after, A is world because bar. sh content is mentioned and executed in the parent process. then change to exec. /bar. sh and the output is before. A is hello because the parent process is replaced, after the sub-process is executed, the subsequent statements will not be executed.

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.