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

Re: list duplicate filenames which only vary by case



On 26 September 2014 11:29, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> On 26 September 2014 11:27, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> On 26 September 2014 11:11, zzapper <david@xxxxxxxxxxxxxx> 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



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