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

Re: strange glob expansion



Bart Schaefer écrivait :
> On Sep 1, 10:11am, Hubert Canon wrote:
> } % echo .scwm/(chan*|**/scwmrc*)
> 
> Directory separators can't be used inside parentheses.

I didn't know that. Thank you.

> % echo .scwm/**/(chan*|scwmrc*)

Yes, it works.

> % echo .scwm/{chan*,**/scwmrc*}

Not exactly. The { , } construct is somewhat different than ( | ) :
for example, when one of the partterns fails, the whole expression
fails.

Like :

% echo (foo*|bar*)
foo
% echo {foo*,bar*}
zsh: no matches found: bar*

The { , } construct always expands its components : echo {foo*,bar*}
is exatcly the same as : echo foo* bar*

That's why I prefer ( | ) in general ofr globbing.

-- 
Hubert Canon



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