#。/和#之间的区别。 ./ [英] difference between #./ and #. ./

查看:184
本文介绍了#。/和#之间的区别。 ./的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么样

# ./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.

这篇关于#。/和#之间的区别。 ./的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆