--------------------------------------------------------------------------------
subshells: () useful in eliminating intermediate files
--------------------------------------------------------------------------------

A subshell allows you to undertake sequential operations at the
command level and then return back to the command line.  Subshells
consist of "()" with commands inside the brackets.

$ (echo "Hello"; echo "Kitty")
Hello
Kitty

$ (echo "Hello";echo "Kitty")>a       #capture output to a file

This does not seem to be of much use. However, as will become clear
by the discussion below, a subshell can eliminate the need for
intermediate files.


Here is an effective use of subshells. Say you want to view the top
and bottom 10 lines of a file.  The simple approach is

$ head file; tail file

You can use subshells to save a bit of typing
$ (head; tail) < file
$ (head;tail)<file     #even fewer strokes!
Thus file acts as input to all commads within the subshell. 

So subshells can accept streams and output streams and that means
subshells can also read files and write files.


Note that th control returns to the calling level after the commands have
been executed.

$ pwd; (cd ..;pwd); pwd    
/Users/srk/SRKUnix/bash         
/Users/srk/SRKUnix
/Users/srk/SRKUnix/bash

Now we will demonstrate how subshells can eliminate the need for 
intermediate files.


$ seq 1 2 3
1
3

$ paste <(seq 1 2 3)
1
3

	|the ouptut of any sushell behave just like any other file
$ paste <(seq 1 2 3) <(seq 2 2 4)
1	2
3	4

voila!