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

Re: Regexp type pattern matching



"Jerry Rocteur" wrote:
> Hi,
> 
> I'm runnign a script under Zsh 4.2.6 on Redhat
> 
> I'm spawning an egrep to do pattern matching:
> 
> if echo ${USER_NAME}|egrep -q "^[prt][0-9]"
> 
> But after a while this stops working and I get:
> rt_sigsuspend(~[HUP CHLD RTMIN RT_1] <unfinished ...

It might be worth trying with a more recent version of the shell; there
are a few fixes for job handling.  If you're spawning a *lot* of
processes it might be the one I've just fixed, zsh-users/12815.

> I've tried to find examples but how do I do this pattern matching in zsh with
> out using egrep:
> 
> if echo ${USER_NAME}|egrep -q "^[prt][0-9]"

It's straightforward...

  if [[ $USER_NAME = [prt][0-9]* ]]; then
    ...
  fi

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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