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'll pass that onto the powers that be, thanks.

>> 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

Oops..

you know I tried that but instead of = I put =~ and it did not work.

Thanks very much for this information I really appreciate it.

Jerry
P.S. Can you please tell me which manual this [[ $USER_NAME = [prt][0-9]* ]] is explained, I looked this morning for a
few hours and I didn't seen anything like this ?



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