If you use source or "." To execute a shell script (such as son. Sh), all statements in the script will be run as part of the current parent shell process. If son. sh execution statement source son. sh or. son. SH is a parent shell script (father. SH), then son. the values of the variables in the sh script or the return values of the functions will be passed to the parent shell script father. sh.
Therefore, use source or ". the biggest difference between using the shell script and using the sh command is that the former loads and executes each line of commands in the script in the current shell, instead of generating a sub-shell to execute these commands.
A typical application is to modify the. bashrc,. bash_profile, and other environment information configuration files in the home directory. You need to execute these files as follows to make the changes take effect:
$ Source. bashrc $ .. bash_profile
Significance of using source or "." To execute shell scripts