Shell scripts are executed in various ways (source./*.sh,. The difference between./*.sh,./*.sh)
Original source: http://blog.csdn.net/dance_rise/article/details/8573560
Conclusion One: The/*.sh is executed in the same way as sh./*.sh or bash./*.sh, the three ways to execute the script are to restart a child shell that executes the script (implemented by fork) in the child shell.
Conclusion two:. Source./*.sh and. The./*.sh is executed in an equivalent manner, either by executing the script in the current shell process, rather than restarting a shell and executing the script in the child shell process.
Validation: Variables that are not exported by export (that is, non-environment variables) cannot be inherited by the shell.
Validation results:
[[Email protected] ~] #name =dangxu//define general variables
[[email protected] ~]# echo ${name}
Dangxu
[[email protected] ~]# cat test.sh//Verify script, instantiate in header./*.sh
#!/bin/sh
Echo ${name}
[[email protected] ~]# ls-l test.sh//Verification script executable
-rwxr-xr-x 1 root root 6 11:09 test.sh
[Email protected] ~]#/test.sh//The following three commands prove the conclusion of a
[Email protected] ~]# sh./test.sh
[[email protected] ~]# bash./test.sh
[Email protected] ~]#. ./test.sh//The following two commands prove the conclusion of two
Dangxu
[[email protected] ~]# source./test.sh
Dangxu
Shell various ways to perform the difference