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

Re: strange glob expansion



On Sep 1, 10:11am, Hubert Canon wrote:
} Subject: strange glob expansion
}
} I tried something like this :
} 
} % echo .scwm/(chan*|**/scwmrc*)

Directory separators can't be used inside parentheses.  Parenthesized
patterns match within one level of file hierarchy only.  (The '/' may
still be useful when matching against strings, as in a `case' label, but
doesn't work when globbing.)

Since ** matches in the current directory as well as in subdirectories,
what you really wanted was

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

Or perhaps

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

Or maybe (if you have extendedglob set)

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

Where the trailing bit with the tilde excludes files that match chan* in
subdirectories.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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