Parentheses
The parentheses structure can force the command to run in the sub-shell. Its basic format is:
(
Command 1
Command 2
...
Command n
)
The N commands in parentheses are run in the sub-shell. After bash version 3, the internal variable bash_subshell is defined. This variable records the layer of the sub-shell..
The sub-shell can only inherit some attributes of the parent shell. However, the sub-shell cannot in turn change the attributes of the parent shell..
The attributes that the sub-shell can inherit from the parent shell are as follows:
Current working directory
Environment Variable
Standard input, standard output, and standard error output
All opened file identifiers
Ignored Signal
The attributes that the sub-shell cannot inherit from the parent shell are summarized as follows:
Shell variables except environment variables and variables defined in the. bashrc File
Unignored Signal Processing
Original
Http://blog.sina.com.cn/s/blog_6bd7d943010152f4.html