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

Re: Some problems with recursive globbing

On Thu, May 7, 2015 at 7:00 PM, Peter Stephenson <p.stephenson@xxxxxxxxxxx>

> $dir contains a straight string with unquoted parentheses.  The
> ~filepattern then turns those parentheses into pattern characters.
> Yes, I understand.

> I'm not sure why you want filepattern anyway, but
> I tried to simplify my function to make my problem obvious. In my "real"
function, I am collecting several function arguments into a combined
pattern, which is why I need to use this indirect method.

local filepattern="**/*"

> print -c ${dir}${~filepattern}
> ought to work.  Otherwise you'll need to quote metacharacters in dir,
> which is possible but should be unnecessary.

Yes, but as my second example demonstrates: if I quote my filepattern, it
then doesn't work for files with spaces in their names. I was hoping for a
solution where it would be possible to get this to work for both situations.

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