roo*_*kie 3 bash shell sh
什么情况下将shell的环境传递给子shell?
Sam*_*ner 5
子 shell 始终从父 shell 获取所有变量。
man bash将描述所有使用子shell的情况,主要是: command & command | command和 ( command )
man bash
command &
command | command
( command )
所谓环境仅包括环境变量(export variable),并传递给各个子进程。即使在调用 时bash -c command,它也不是子 shell,而是一个全新的 bash 实例。
export variable
bash -c command
在这两种情况下,更改的值都不会传递回父进程。
归档时间:
8 年,10 月 前
查看次数:
2029 次
最近记录: