From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20036 invoked by alias); 26 Sep 2014 09:35:05 -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: 19161 Received: (qmail 29574 invoked from network); 26 Sep 2014 09:35:04 -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,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 :cc:content-type; bh=L8aXkOsPp2M1U3m1NLAJBemdf+/UW23uC//PVY4HqcY=; b=s8obtstp99Heau9IyOjYDoWUMVc+2Pw9mRVzJrr0gkOn6YGc0yjp7ETolRZkAx4lCC McAPc8kQ+k+CELIiQYI1dAJniuLOGPJu8mlUKlBSvv4LT2pZzbBMHRgntPUyFD6kcf6l BJd4QHRzxsOsN64CAYqIjVujvElJV9ZR77uC8qnqQdSnoUbXMfVdqhwPDWyMX8IuGNOQ Pw9CaHTTRoKpff/rxr/3rGThuA5QDWkzixYi0R1z7wgzHCWd7OlQxFLT79cQQbLAb3XN Fwa746esHSW7tcEOdmGHWFZIHDr/hub047CAzlt+8OxasyuLa/eCyp7FOE+mL6B3F6uY Pu/Q== MIME-Version: 1.0 X-Received: by 10.42.30.142 with SMTP id v14mr26089469icc.66.1411724100909; Fri, 26 Sep 2014 02:35:00 -0700 (PDT) In-Reply-To: References: Date: Fri, 26 Sep 2014 11:35:00 +0200 Message-ID: Subject: Re: list duplicate filenames which only vary by case From: Mikael Magnusson To: zzapper Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 On 26 September 2014 11:29, Mikael Magnusson wrote: > On 26 September 2014 11:27, Mikael Magnusson wrote: >> On 26 September 2014 11:11, zzapper wrote: >>> Hi >>> >>> list files with duplicates in same directory >>> e.g. >>> house.jpg House.jpg hOUSE.jpg >>> >>> I guess it needs a e[$REPLY...] clause >> >> () { setopt localoptions nocaseglob; print -rl - *(e,'[[ -n >> $REPLY(#q[2]) ]]',) } >> >> I couldn't figure out any syntactically valid way to insert (#i) in >> the glob. If that were possible you wouldn't need the function and >> local option. > > Of course this also works.. duh :) > print -rl - *(e,'setopt nocaseglob; [[ -n $REPLY(#q[2]) ]]',) Sorry for triple posting, the last version only "works" for external commands, eg, when we fork before performing the glob, or it will change the caseglob setting in the parent shell (for example when using the print builtin), so I go back to recommending the first version. -- Mikael Magnusson