From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13688 invoked by alias); 8 May 2015 03:38:07 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20194 Received: (qmail 25929 invoked from network); 8 May 2015 03:38:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Ekiyt/zLhZ1OqekZavzRn7+ymNFXN2LCAn4t7FkwUpo=; b=gxL9L1FnKLHTXXRxxSfGOhtc2cgnVf6qZE6W6N1ZD7J5d27yaJcmUuu49qD7gP62O/ Y2snv49md58FooNfJHhSSOqxqXL9Og7sHx+ZW3Xh8TEPhFB6TVgHujHH/WS0AUY6YNcN R2Fecdfbwo0tjKwZBrvoZPtxic6WMpytbh1QRhR6tPodCci6WTab9mE0AK46RGmZBm1C QNXVccCExYC/i8oYVg2JyKjy77KMTzV9lPW6sFhL9NyTf4JuCwUAeVPZHcmGnBjJATmQ Fh44Ee8F55Gh2UskRXEe/wfpFidi0/d580T5s+4pxiU1XHfk2A2q1WiHDDOHJ+cLuUWx JdNA== MIME-Version: 1.0 X-Received: by 10.112.199.133 with SMTP id jk5mr201342lbc.32.1431056279565; Thu, 07 May 2015 20:37:59 -0700 (PDT) In-Reply-To: References: <20150507165250.18184e1a@pwslap01u.europe.root.pri> <20150507165953.517b95b9@pwslap01u.europe.root.pri> <20150507180045.0afc79fd@pwslap01u.europe.root.pri> Date: Fri, 8 May 2015 05:37:59 +0200 Message-ID: Subject: Re: Some problems with recursive globbing From: =?UTF-8?Q?Jesper_Nyg=C3=A5rds?= To: Zsh Users Content-Type: multipart/alternative; boundary=001a11c264be32793b051589c1d5 --001a11c264be32793b051589c1d5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I found a solution to my particular problem. I can quote the dir, and then remove the quoting of the spaces afterwards. myfiles() { emulate -L zsh setopt LOCAL_OPTIONS EXTENDED_GLOB local dir=3D"${(q)1:a}/" dir=3D${dir/\\\ / } local filepattern=3D"${dir}**/*" print -c ${~filepattern} } I realize this could brake on even more exotic file names, but for now I'm happy with this solution. On Thu, May 7, 2015 at 7:21 PM, Jesper Nyg=C3=A5rds wrote: > On Thu, May 7, 2015 at 7:00 PM, Peter Stephenson > wrote: > >> $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=3D"**/*" > >> 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 situatio= ns. > > > --001a11c264be32793b051589c1d5--