It's recorded in a shell script.
. ./file.sh and
/file.sh the difference, this article refers to the http://www.lslnet.com/linux/dosc1/39/linux-283534.htm (this blue forest thing should be derived from Chinaunix)
A little experiment.
Scenario One:
VI file1.sh
./file2.sh
Echo $NIVEK
VI file2.sh
Nivek=goupi
Export Nivek
chmod 755 file1.sh file2.sh
$./file1.sh
Without any output
$
Scenario Two:
VI 1file.sh
. ./2file.sh
Echo $NIVEK
VI 2file.sh
Nivek=goupi
Export Nivek
chmod 755 1file.sh 2file.sh
$./1file.sh
Goupi//2file.sh The value of the variable Nivek in the export
$
From this we can see the difference between them, namely
The./file.sh will reboot a new child shell to execute it, so if some of the variables defined in the file.sh (export) are only useful in the child shell, the return will be lost.
. ./file.sh does not start a new shell and executes in the current shell, so the variable defined in file.sh still works after it is returned.
Let's look at this simple example:
Cat 1.sh
#!/bin/bash
Sleep 1
Exit 1
Cat test1.sh
#!/bin/bash
./1.sh
echo "Can See Me"
Cat test2.sh
#!/bin/bash
. ./1.sh
echo "Can See Me"
Perform test1.sh separately, test2.sh from their differences can see a few different
Reference
Http://blog.chinaunix.net/uid-20652643-id-1906458.html
[The source command in the]shell is followed by a dot space and a description of the executable file