#。/和#之间的区别。 ./

#。/和#之间的区别。 ./

问题描述:

什么样

# ./test

# . ./test 

测试,例如简单的脚本

test is simple script for example

#!/bin/bash
export OWNER_NAME="ANGEL 12"
export ALIAS="angelique"

我知道结果,但即时通讯无法确定到底发生了什么。

i know the results but im unsure what actually happens

感谢

./富执行,如果它是标记为可执行文件,并有适当的shebang行(或者是一个ELF二进制)。这将在一个新的进程来执行。

./foo executed foo if it's marked as executable and has a proper shebang line (or is an ELF binary). It will be executed in a new process.

。 ./foo 。富加载在电流的外壳脚本。它等于源富

. ./foo or . foo loads the script in the current shell. It is equal to source foo

随着你的榜样code你需要,如果你想导出的变量在你的shell可使用第二种方式。

With your example code you need to use the second way if you want the exported variables to be available in your shell.