Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: something simple (I hope)



Andy Spiegl wrote [2003/08/04]:
> > > I want to put all files that match the regex pattern
> > >  "^/var/tmp/exec\.[0-9]+$"
> > > into a list that I can then use in a foreach loop.
> 
> > for i in /var/tmp/exec.[0-9][0-9]* ; do echo $i ; done
> Thanks but I really need a list (with a name).
> Actually in the meantime I found out how to do that:
>  files=(/var/tmp/exec.[[:digit:]]*)
> 
> But what is still bugging me is that this also matches files like
>  /var/tmp/exec.01234.something
> 
> I can't figure out how to tell zsh that there shouldn't be anything _after_
> digits.  What is the zsh-equivalent of a $ in regular expressions?

I have no idea for the "$" problem, but have you tried this?
files=(/var/tmp/exec.<->)
                     ^^^
                     <[n]-[m]> matches any number in the range n
                     to m, both of which are optional...

> Thanks again,
>  Andy.

Ciao,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@xxxxxxxxxxxxxxxxx     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

Attachment: pgp895NRqD2lY.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author