$ FOO=1 # Set the variable
$ echo $FOO # Check the value
1
$ bash # New shell here.
$ echo $FOO # No value since it's not exported
$ exit # Quit the subshell
$ export FOO # Export it
$ bash
$ echo $FOO # It has a value now
1
export 是一个内置于bash的shell,所以做一个 help export 会给你更多的信息 .
2 回答
如果你
export
(无论如何,我认为是你的shell),它将标记在随后执行的命令中可用的东西 .export
是一个内置于bash的shell,所以做一个help export
会给你更多的信息 .显式导出PATH并没有什么坏处,但通常没有效果,因为在启动shell脚本时,PATH变量几乎肯定已标记为已导出 .