SOURCE $ & Bash

Source: Internet
Author: User

When Bash file.sh is started this way, it is set to the file name.

Source is Bash's built-in command to read the file into the current bash execution, which is equivalent to entering the command manually at the current bash , so $ is bash.

The sample code is as follows:

a.sh

Echo " In a.sh. \$0 is: $ A "

b.sh

Echo " In b.sh. \$0 is: $ A " . . /A.sh

Run as follows:

LxW ~$Echo$0 bashLxW~$ source A.SHinchA.SH. $0is : bashLxW~$ Source B.SHinchB.SH. $0is : bash inchA.SH. $0is : bashLxW~$ bash A.SH inchA.SH. $0Is:a.SHLxW~$ Bash B.SH inchB.SH. $0Is:b.SHinchA.SH. $0Is:b.SHLxW~$Echo$0 bashLxW~$

Reference:

What does the Linux shell mean by: http://zhidao.baidu.com/link?url= 5lnei7gpe4u59nhcqcuf6rjcwxyb3zkktr4zxiidcle7zltnmtug-8cazfzko6ojfckac6fl1ddjtyi1ftu7ankoz22t6nzfit-q4cuk8me

SOURCE $ & Bash

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.