The following content is based on the Linux bash Environment
There are many ways to run shell scripts in Unix. Suppose there is a script that can be run called test. sh. You can add the script file name, source test. sh (= .. /test. sh two .), you can also use. /path/test. sh mode. If the script is in the path, it can be run in bytes using the script name, such as test. sh.
The difference between them is:
Source test. Sh allows test. Sh to run in the current shell process without starting shell.
./Test. Sh (only one vertex) and test. Sh (test. Sh must be in the path) will start Shell Running.
In addition, when a shell script is placed in the path, especially when there is no sh suffix, if the system has alias, function and shell script with the same name, alias and function have a higher priority.
For example, the system has an alias: alias Ft = "Echo ft is an alias"
There is also a function also called ft () {echo ft is a function}
Then there is also an FT script file in the Path (for example, the current path directory is also set to path), with the content echo ft is in a script
If you run ft in shell, alias will be executed. If you remove alias and unalias ft, the function will be executed. If you want to execute the script ft, you can use./ft
When running the script is not the expected result, you can use the type script name to check whether there are alias and function with the same name. The type-all FT can be used to list all FT definitions.