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

Re: /proc slows % echo /**/*/etc/r*(/N)



On 1/21/24, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Sun, Jan 21, 2024 at 9:19 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>>
>> I used to do this kind of thing without any problems:
>>
>>      % echo /**/*/etc/r*(/N)
>>
>> ... but just trying it, zsh labors for close to an hour, then spits out
>> countless pages of:
>
> Without trying it, which I'm not going to do, I think the answer to
> your specific question might be:
>
> echo /**/^(proc|sys)/etc/r*(N)
>
> But that might actually miss /etc/r* because it would be looking for
> /etc/etc/.  There's no syntax for excluding things specifically from
> the ** pattern.

You actually can, **/ is shorthand for (*/)# although the latter only
works with extended_glob enabled, the shorthand always works. You can
use any pattern in place of the * if you want (for example,
(^(a|b|c)/)# which would exclude a, b or c from any segment being
recursed), although in the case above I think you'd have actually
wanted /^(proc|sys)/**/etc/r* if the problem was not another typo.

-- 
Mikael Magnusson




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