bash: Command Grouping

1 
1 3.2.4.3 Grouping Commands
1 .........................
1 
1 Bash provides two ways to group a list of commands to be executed as a
1 unit.  When commands are grouped, redirections may be applied to the
1 entire command list.  For example, the output of all the commands in the
1 list may be redirected to a single stream.
1 
1 '()'
1           ( LIST )
1 
1      Placing a list of commands between parentheses causes a subshell
1      environment to be created (⇒Command Execution Environment),
1      and each of the commands in LIST to be executed in that subshell.
1      Since the LIST is executed in a subshell, variable assignments do
1      not remain in effect after the subshell completes.
1 
1 '{}'
1           { LIST; }
1 
1      Placing a list of commands between curly braces causes the list to
1      be executed in the current shell context.  No subshell is created.
1      The semicolon (or newline) following LIST is required.
1 
1    In addition to the creation of a subshell, there is a subtle
1 difference between these two constructs due to historical reasons.  The
1 braces are 'reserved words', so they must be separated from the LIST by
1 'blank's or other shell metacharacters.  The parentheses are
1 'operators', and are recognized as separate tokens by the shell even if
1 they are not separated from the LIST by whitespace.
1 
1    The exit status of both of these constructs is the exit status of
1 LIST.
1