13.8 Using {list} to Group Bourne Shell CommandsA lot of people know that you can group the output of a series of commands by using a subshell ( 13.7 ) . That is, instead of this:
$ they start a subshell with parentheses:
and only redirect once to
log
.
But a subshell takes an extra process and takes time to start on a busy
system.
If all you need to do is redirect output (or input) of a set of
commands, use the Bourne shell's list operators
$ Notice the spaces and the extra RETURN at the end. Each command must be separated from others. You can also write (note the semicolon after the last command):
$ Here are two other differences between the subshell (parentheses) and list (curly braces) operators. A cd command in the subshell doesn't change the parent shell's current directory; it does in a list. Also, a variable set in a subshell isn't passed to the parent shell; from a list, the variable is passed out.
- |
|