From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 1cfb5a62 for ; Tue, 19 Nov 2019 09:35:58 +0000 (UTC) Received: (qmail 6327 invoked by alias); 19 Nov 2019 09:35:48 -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: List-Unsubscribe: X-Seq: 24448 Received: (qmail 4942 invoked by uid 1010); 19 Nov 2019 09:35:48 -0000 X-Qmail-Scanner-Diagnostics: from mailout2.w1.samsung.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25635. spamassassin: 3.4.2. Clear:RC:0(210.118.77.12):SA:0(-7.0/5.0):. Processed in 3.636726 secs); 19 Nov 2019 09:35:48 -0000 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.samsung.com designates 210.118.77.12 as permitted sender) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20191119093505euoutp0202382eaf51b91d3c50680e70b62879e1~YhqMngJtj0392503925euoutp02K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1574156105; bh=QY2RKOvrLep3Faf1qwO7NGSQLsC0FC8oBdyfUQRNmE0=; h=Subject:From:To:Date:In-Reply-To:References:From; b=qXy3YoyhGopvRrENrhr+H+fzk+07DKODisXIJl3CP34ng9b1sfN40w41a4CZG/qHh drkMNibIn1nH7/J9Xb8ahYXmwoySquWqNrSkVbTOrSKWnvIR02d1Tn3jntxCofMVsx a72G4l+53nMS15ydf5LYe/Vys25G5PezgmClBHUo= X-AuditID: cbfec7f4-ae1ff700000010d5-36-5dd3b748a7cd Message-ID: <1574156103.6021.2.camel@samsung.com> Subject: Re: Questions from zshexpn(1) -- Globbing From: Peter Stephenson To: Date: Tue, 19 Nov 2019 09:35:03 +0000 In-Reply-To: X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPIsWRmVeSWpSXmKPExsWy7djPc7oe2y/HGkxoMbXYcXIlowOjx6qD H5gCGKO4bFJSczLLUov07RK4Mo4en89W8JWv4u6uGywNjNN4uhg5OSQETCQeTGhn72Lk4hAS WMEo8f3cChYIp4dJ4vrehawQTjeTxNSJF5lhWu7vX8kMkVjOKLHnwVsmuKpzrx8wQjhnGCWm T3kFlbnAKHGhcSYTSD+vgKFE9+NzbCC2sICRxIVdV8HibEDxqZtmM4LYIgLiEs9mfmMBsVkE VCV2f+piBbE5BVwkJi46wgJxh4bEhpvHoGYKSpyc+QQsziwgL9G8dTbUrc/ZJP7060LYLhIX n05nhLCFJV4d38IOYctI/N85H+xQCYF2Rok1k16zQzg9jBKbjt6B6rCW6Lt9EcjmANqgKbF+ lz5E2FHiQt8iNpCwhACfxI23ghA38ElM2jadGSLMK9HRJgRRrSaxo2krI0RYRuLpGoUJjEqz kDwwC8kDsxBWLWBkXsUonlpanJueWmyUl1quV5yYW1yal66XnJ+7iRGYDE7/O/5lB+OuP0mH GAU4GJV4eE+oXI4VYk0sK67MPcQowcGsJMLr9+hCrBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHe aoYH0UIC6YklqdmpqQWpRTBZJg5OqQZGscMzbDaeWDzjy9G2svY9M80Ut6RZBFW/2zp7+06V XZnhDE4d0v3FKov4FZrMNl7c/i50h9MJKYFnR7er7Fb/mnfzdk7hqcsOb28IXyvYcO9jVdKT l+W2x/iaf00IWfZ+leiS1tDIf6rZvQUZZVWsPl9kPj6vK2buzFmxw850pmv8h4txfClCSizF GYmGWsxFxYkA4DA9mwIDAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeLIzCtJLcpLzFFi42I5/e/4XV2P7ZdjDX5uU7DYcXIlowOjx6qD H5gCGKP0bIryS0tSFTLyi0tslaINLYz0DC0t9IxMLPUMjc1jrYxMlfTtbFJSczLLUov07RL0 Mo4en89W8JWv4u6uGywNjNN4uhg5OSQETCTu71/J3MXIxSEksJRRYtb5j8wQCRmJT1c+skPY whJ/rnWxQRR1Mkmc+rURyjnDKPHm4AMWCOcCo8SrP59ZQFp4BQwluh+fYwOxhQWMJC7susoE YrMBxadums0IYosIiEs8m/kNrJ5FQFVi96cuVhCbU8BFYuKiI2BxIYEZjBLTP+eC2MwCmhKt 239DnaQhseHmMSaIXYISJ2c+YYGokZdo3jqbeQKj0CwkLbOQlM1CUraAkXkVo0hqaXFuem6x oV5xYm5xaV66XnJ+7iZGYPhvO/Zz8w7GSxuDDzEKcDAq8fCeULkcK8SaWFZcmXuIUYKDWUmE 1+/RhVgh3pTEyqrUovz4otKc1OJDjKZAD01klhJNzgfGZl5JvKGpobmFpaG5sbmxmYWSOG+H wMEYIYH0xJLU7NTUgtQimD4mDk6pBsbiNX+2rbhgxbDXr6r25+X5L0urwu783Tmts/pKNdvq iSHTtm2bfb881lDsVK/h9gkfXD8s4j/iuOV82y3Ll6ERSQtCRdsUF22r+M8ot8hNrbhU59gZ hRWXv4pwZWh2zdZqeM9zce7Dm5lisz543eNpUvnxNZ/jqtTBG/smNwmvjvDnW/3+26HtSizF GYmGWsxFxYkAEG1Wb5UCAAA= X-CMS-MailID: 20191119093504eucas1p29363a1c49ce787f58eda49cc16b0cc64 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20191119005526eucas1p2f346934679a40e37d2424b3ab6df4cbc X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191119005526eucas1p2f346934679a40e37d2424b3ab6df4cbc References: On Mon, 2019-11-18 at 18:53 -0600, Perry Smith wrote: > The subsection is Globbing Flags within Filename Generation with both > the b and m flags is a curious phrase: > >> Activate backreferences for parenthesised groups in the pattern; >> this does not work in filename generation.  > Why does it say “this does not work in filename generation” ?  Using > their example for the m flag:  >  >>           arr=(veldt jynx grimps waqf zho buck) >>           print ${arr//(#m)[aeiou]/${(U)MATCH}} > I can change the “print” to “touch” and it touches the files and > change it to “rm” and it removes the files.  >  > My fear here is that I’m missing something rather significant such as > what precisely is “filename generation” You're using that feature in variable substitution, not filename generation. Filename generation is specifically the use of pattern characters *, ?, etc. to generate file names.  So what this means is that the patterns generated by that method aren't available for use in what I called backreferences (that's a bad name, sorry: when used in regular expressions, its standard meaning is references back to a previous part of the same pattern, which isn't what's happening here). So if instead of using the array you matched the files directly, having created them:     touch $arr     print (#m)*([aeiou])* you'd have no way of using the references generated because the file names are substituted before the $MATCH variable would be available --- which is probably obvious. Of course, even if you needed to match the files on the disk first you could still do     arr=(*)     print ${arr//(#m)[aeiou]/${(U)MATCH}} so you've still got the ability to change the file names with variable substitution. So this is probably saying less than you think it is. pws