Thank you for all the help, Peter. On Fri, May 8, 2015 at 10:40 AM, Peter Stephenson wrote: > On Fri, 8 May 2015 05:37:59 +0200 > Jesper Nygårds wrote: > > I found a solution to my particular problem. I can quote the dir, and > then > > remove the quoting of the spaces afterwards. > > Yes, or the other approach is quote only the metacharacters (which don't > include space) in the first place. I think there may be some examples > lying around using ${...//.../...}. Oh, yes, here's one from _rm: > > ${line//(#m)[\[\]()\\*?#<>~\^\|]/\\$MATCH} > > It would be overall simpler not to pass the pattern and a fixed string > around in the same variable, involving a bit of structural change. > > pws >