[Gllug] Bourne shell programming

John G Walker johngwalker at tiscali.co.uk
Sun Nov 19 11:46:54 UTC 2006



On Sun, 19 Nov 2006 11:34:55 +0000 "Pete Ryland" <pdr at pdr.cx> wrote:

> > > How can I replace stdin with the output of my previous command? I
> > > need to be able to read from the pipeline....  
> >
> > grep root /etc/passwd | awk -F: '{print $1,$2,$3}' > tmp.txt  
> 
> BTW, what's wrong with the 'cut' command?

This seems to be complicating what is a simple scope problem. Always
define variables in the block in which you want to use them (or an
outer block). That way you don't need to think up techniques (simple or
otherwise) to pass information to an outer block,

-- 
 All the best,
 John
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list