[ale] BASHing my head

Alex Carver agcarver+ale at acarver.net
Wed Aug 26 12:48:48 EDT 2015


The advantage of using the globasciiranges option is that you don't have
to change your locale which can happen with LC_ALL and LC_COLLATE.  It
just does a direct ASCII comparison.


On 2015-08-26 09:14, Scott Plante wrote:
> 
> I didn't know the globasciiranges option. 
> 
> Another solution is the LC_COLLATE variable: 
> 
> splante:/tmp/x/> ls 
> a.pdf A.pdf b.pdf B.pdf 
> splante:/tmp/x/> ls [A-Z].pdf 
> A.pdf b.pdf B.pdf 
> splante:/tmp/x/> LC_COLLATE=C 
> splante:/tmp/x/> ls [A-Z].pdf 
> A.pdf B.pdf 
> splante:/tmp/x/> LC_COLLATE=en_US 
> splante:/tmp/x/> ls [A-Z].pdf 
> A.pdf b.pdf B.pdf 
> 
> This is probably a better solution: 
> 
> splante:/tmp/x/> ls [[:upper:]].pdf 
> A.pdf B.pdf 
> 
> 
> Scott 
> 
> 
> ----- Original Message -----
> 
> From: "Alex Carver" <agcarver+ale at acarver.net> 
> To: ale at ale.org 
> Sent: Wednesday, August 26, 2015 11:34:02 AM 
> Subject: Re: [ale] BASHing my head 
> 
> You need to set the shopt globasciiranges otherwise it uses the values 
> as lexical rather than pure ASCII values. 
> 
> 
> On 2015-08-26 08:22, Scott M. Jones wrote: 
>> For some reason my wildcard search in bash starting with uppercase 
>> letters is finding files starting with lower case. I checked my 'shopt' 
>> options and they should be correct, but changing them doesn't change the 
>> results. In this case I DO want a case sensitive search but I'm not 
>> getting that. What am I doing wrong? (Fedora 21 bash BTW.) 
>>
>> [scott at vbox21 tentcards]$ echo $SHELL 
>> /bin/bash 
>> [scott at vbox21 tentcards]$ ls [A-Z]*.pdf 
>> no_materials.pdf tentcard.pdf tentcard_short.pdf tents.pdf 
>> tents_short.pdf 
>> [scott at vbox21 tentcards]$ shopt | grep -i case 
>> nocaseglob off 
>> nocasematch off 
>> [scott at vbox21 tentcards]$ shopt -s nocaseglob 
>> [scott at vbox21 tentcards]$ shopt -s nocasematch 
>> [scott at vbox21 tentcards]$ ls [A-Z]*.pdf 
>> no_materials.pdf tentcard.pdf tentcard_short.pdf tents.pdf 
>> tents_short.pdf 
>> [scott at vbox21 tentcards]$ shopt | grep -i case 
>> nocaseglob on 
>> nocasematch on 
>> [scott at vbox21 tentcards]$ 
>> _______________________________________________ 
>> Ale mailing list 
>> Ale at ale.org 
>> http://mail.ale.org/mailman/listinfo/ale 
>> See JOBS, ANNOUNCE and SCHOOLS lists at 
>> http://mail.ale.org/mailman/listinfo 
>>
> 
> _______________________________________________ 
> Ale mailing list 
> Ale at ale.org 
> http://mail.ale.org/mailman/listinfo/ale 
> See JOBS, ANNOUNCE and SCHOOLS lists at 
> http://mail.ale.org/mailman/listinfo 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
> 



More information about the Ale mailing list