Skip to content

Commit 4e5977b

Browse files
committed
Update export.md
1 parent 929b2f5 commit 4e5977b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

command/export.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ export LD_LIBRARY_PATH=$(pwd):${LD_LIBRARY_PATH}
101101

102102
#### Q:对变量或函数设置导出属性有什么用?
103103

104-
A:它们会成为环境变量,可以在脚本中访问它们,尤其是脚本中调用的子进程需要时。( **参考链接4**
104+
A:它们会成为环境变量,可以在脚本中访问它们,尤其是脚本中调用的子进程需要时。( **[参考链接4][4]**
105105

106106
#### Q:如果我编写的脚本修改了已有的环境变量的值,那么执行它会在当前终端生效吗?会影响之前以及之后打开的终端吗?
107107

108108
A:只有通过`source`方式调用的脚本会生效,您可以查看`source`命令获得更多信息;其他方式只是在子shell中执行。
109-
之前的不会影响,之后的除非是修改了`~/.bashrc`这种启动终端时加载的脚本。( **参考链接1**
109+
之前的不会影响,之后的除非是修改了`~/.bashrc`这种启动终端时加载的脚本。( **[参考链接1][1]**
110110

111111
#### Q:我脚本文件中调用`~/.bashrc`中定义的函数和变量。为什么在新打开的终端中通过 `sh` 方式调用该脚本或直接运行
112112

@@ -115,7 +115,7 @@ A:请在`~/.bashrc`文件中增加export它们的语句。另请参阅 **知
115115

116116
#### Q:数组和关联数组也可以设置导出属性吗?
117117

118-
A:是可以的(如果你的bash支持它们),不过有些问题( **参考链接2** )。
118+
A:是可以的(如果你的bash支持它们),不过有些问题( **[参考链接2][2]** )。
119119

120120
#### Q:为什么我在查看变量或函数导出属性的时候显示的开头是`declare`
121121

@@ -146,10 +146,10 @@ A:因为`declare`也能够设置变量或函数的导出属性,详见`declar
146146

147147
### 参考链接
148148

149-
1. [关于bashrc profile文件的讨论](https://www.cnblogs.com/hongzg1982/articles/2101792.html)
150-
2. [关于export数组的讨论](https://stackoverflow.com/questions/5564418/exporting-an-array-in-bash-script)
151-
3. [export -pf用法](https://unix.stackexchange.com/questions/22796/can-i-export-functions-in-bash)
152-
4. [环境变量和shell变量的区别](https://askubuntu.com/questions/26318/environment-variable-vs-shell-variable-whats-the-difference)
149+
1. [关于bashrc profile文件的讨论][1]
150+
2. [关于export数组的讨论][2]
151+
3. [export -pf用法][3]
152+
4. [环境变量和shell变量的区别][4]
153153

154154
### 扩展阅读
155155

@@ -179,5 +179,9 @@ declare -x TERM="linux"
179179
declare -x USER="root"
180180
```
181181

182+
[1]: https://www.cnblogs.com/hongzg1982/articles/2101792.html
183+
[2]: https://stackoverflow.com/questions/5564418/exporting-an-array-in-bash-script
184+
[3]: https://unix.stackexchange.com/questions/22796/can-i-export-functions-in-bash
185+
[4]: https://askubuntu.com/questions/26318/environment-variable-vs-shell-variable-whats-the-difference
182186

183187
<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->

0 commit comments

Comments
 (0)