Linux source command: The source command is also known as the "dot command", that is, a dot symbol (.), which is an internal bash command. Function: enables the Shell to read the specified Shell program file and execute all the statements in the file in sequence. The source command is usually used to re-execute the modified initialization file to make it take effect immediately without logging out and logging on again. Usage: source filename or. the filenamesource command (from the C Shell) is the built-in command of the bash shell; the dot command (.), the dot symbol (from the Bourne Shell) is another name of the source. What is the difference between the source filename of www.2cto.com and the script executed by sh filename and./filename? 1. When the shell script has the executable permission, there is no difference between using sh filename and./filename to execute the script .. /Filename indicates that the current directory is not in the PATH, and all "." indicates the current directory. 2. sh filename re-creates a sub-shell and executes the statements in the script in the sub-shell. The sub-shell inherits the environment variables of the parent shell, the new and changed variables created by the sub-shell are not brought back to the parent shell unless export is used. 3. source filename: The command simply reads the statements in the script and runs them in the current shell. No new sub-shell is created. All statements for creating and changing variables in the script are saved in the current shell. Example of www.2cto.com: 1. create a test. sh script with the following content: A = 12. then execute chmod + x test. sh3. run sh test. sh, echo $ A, displayed as null, because A = 1 is not returned to the current shell4. run. /test. sh, the same effect 5. run source test. sh or. test. sh, And Then echo $ A, 1 is displayed, indicating that the variable A = 1 is in the Current shell