Under what circumstances is the environment of the shell passed to the sub-shell?
相关问题
- How to get the return code of a shell script in lu
- JQ: Select when attribute value exists in a bash a
- Invoking Mirth Connect CLI with Powershell script
- Emacs shell: save commit message
- bash print whole line after splitting line with if
相关文章
- 使用2台跳板机的情况下如何使用scp传文件
- Why does popen() invoke a shell to execute a proce
- In IntelliJ IDEA, how can I create a key binding t
- Check if directory exists on remote machine with s
- shell中反引号 `` 赋值变量问题
- How get the time in milliseconds in FreeBSD?
- Reverse four length of letters with sed in unix
- Launch interactive SSH bash session from PHP
A subshell always gets all variables from the parent shell.
man bash
will describe all the circumstances in which a subshell is used, which are mainly:command &
command | command
and( command )
The so called environment only includes environment variables (
export variable
), and is passed on to every sub-process. Even when invokingbash -c command
, which is not a sub-shell but a completely new bash instance.In both cases changed values are not passed back to the parent process.