[Gllug] Bizarre shell behaviour
Dylan
dylan at dylan.me.uk
Sat Nov 8 02:17:59 UTC 2003
On Friday 07 November 2003 23:57 pm, Bruce Richardson wrote:
> On Fri, Nov 07, 2003 at 11:27:51PM +0000, Dylan wrote:
> > On Friday 07 November 2003 17:16 pm, Tethys wrote:
> > > Take the following shell script. Run it:
> > >
> > > #!/bin/sh
> > >
> > > count=0
> > > while read var
> > > do
> > > count=1
> > > done < /etc/group
> > >
> > > echo $count
> >
> > Just out of interest (and 'cos I'm trying to learn shell scripting) can
> > someone explain what this is supposed to achieve. The loop is obvious,
> > but what's the redirection all about?
>
> It's reading from the file /etc/group, one line at a time.
Thanks. I added an echo $var before the done and got a listing of the file so
I figure each line is going into $var. How does this work then?
Dylan
--
Sweet moderation
Heart of this nation
Desert us not
We are between the wars
- Billy Bragg
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list