Basic functionality of the source command under Linux
Author: faint de happiness
SourceCommand usage:
SOURCE FileName
Role:in the currentBashread and execute in the environmentFileNamecommands in the.
Note: This command usually uses the command "."to replace.
Such as:source. BASH_RCwith the.. BASH_RCis equivalent.
Attention:SourceCommand andShell Scriptsthe difference is that
Sourcein the currentBashenvironment to execute commands, whileScriptsis to start a childShellto execute the command. This way, if you set the environment variable (oraliasand so on) commands written inScriptsonly affects the sub-Shell,cannot change the currentBASH,So when setting an environment variable from a file (command column), use theSourcecommand.
[Email protected] ~]# echo "Export path= $PATH:/usr/local/apache2/bin/" >/etc/profile.d/apache.sh
[Email protected] ~]# source/etc/profile.d/apache.sh
Basic functionality of the source command under Linux