13.7 The () Subshell Operators
A useful shell trick is to use parentheses, 13.7.1 Combining Several CommandsThe output of the entire group can be passed together into a single pipeline. For example:
This will interpose the
nroff
(
43.13
)
Parentheses are also very useful in the Bourne shell if you want to put an entire sequence of commands separated by semicolons into the background. In the C shell, the command line below will go immediately into the background.
But in the Bourne shell, the background request (
$ 13.7.2 Temporary Change of Directory and EnvironmentThe parentheses start a subshell ( 38.4 ) . Commands that run between the parentheses won't affect the parent shell's environment. For instance, to run a command in another directory without changingyour active shell's current directory : ( 38.3 )
% The file file.out will be created in the somewhere-else directory. Article 13.8 shows another method for the Bourne shell. It's more limited but can also be more efficient. - , |
|