ter*_*don 10
它是来源。执行和采购之间的区别在这篇文章中有解释。这里的重要区别在于,source 导致源文件中的命令在当前 shell 中运行。这意味着文件中定义的任何变量现在都可以在 shell 中使用。为了说明差异,请尝试以下操作:
$ cat foo ## a simple file with a variable definition
var="hello"
$ chmod +x foo ## make file executable
$ ./foo ## execute
$ echo "$var" ## var is not set in the parent shell
$ . foo ## source
$ echo "$var" ## var is now set in the parent shell
hello
Run Code Online (Sandbox Code Playgroud)
因此,由于/etc/profile需要能够影响从它读取的 shell,它是来源而不是执行的。
| 归档时间: |
|
| 查看次数: |
957 次 |
| 最近记录: |