Home Network Problem

Jeffrey Wong jmwong at math.ed.hawaii.edu
Sat Mar 24 14:04:51 PST 2001


Actually, its part of grep.  Grep uses regexp style patterns which is
where the [] comes from.  Shells generally don't support regexp, but most
do have pattern searching commands simillar to regexp.  This is why using
grep to look for things like '.' doesn't act the same way as shell pattern
expansion.  Shells consider '.' to be a litteral character while regexp
defines '.' as matching any single character.

If you don't know regexps, I highly suggest you learn them. A good book is
the O'Reily 'Using Regexps' (Don't recall the exact title but it's
something like that).  They come in real handy, not only for grep, but if
you do any work with perl or python.  In addition many unix text editors
also use regexp's such as vi and emacs.

And one last bit of trivia for today: The grep commands gets it name from
what it does.  It finds Global Regular Expression Patterns.  And regexp
gets it name from REGular EXPression.

Jeff Wong

On Sat, 24 Mar 2001, Ray Strode wrote:

> > I don't think it's shell specific, but a feature of the grep program
> itself.
> > I could be wrong, but I'm not gonna go look through the source :-)
> Oh it's quite shell specific, unless grep implements some hack, which I
> really really doubt.  square brackets are used for selecting multiple
> choices on the command line.  like try this:
> touch foo boo
> ls [fb]oo
> It should return both foo and boo.  What happens is the shell sees the
> brackets and expands them to include both foo and boo.  It then sends
> that result to ls.  If you know any c programming, this would be equivalent
> to setting argv[1] to foo and argv[2] to boo before calling main().  That
> feature is found in modern shells, but wont' work in all shells (like csh
> instance).  Now in your case, you used only one letter in the brackets,
> which
> is equivalent to not using the brackets at all.
>
> --Ray
>
>
>
>
> ---
> You are currently subscribed to luau as: jmwong at math.ed.hawaii.edu
> To unsubscribe send a blank email to $subst('Email.Unsub')
>



More information about the LUAU mailing list