Re: Problem with Bash regex test case sensitivity

2010-12-04 Thread Lee Rothstein
On 12/4/2010 5:34 PM, Lee wrote: On 12/4/10, Lee Rothstein wrote: On 12/4/2010 10:06 AM, Corinna Vinschen wrote: > On Dec 4 10:05, Lee wrote: >> On 12/3/10, Eric Blake wrote: Here's my takeaway, given Corinna's interesting and complete context, and my intents. (My intentions, BTW, are f

Re: Problem with Bash regex test case sensitivity

2010-12-04 Thread Eric Blake
On 12/04/2010 02:49 PM, Lee Rothstein wrote: > Therefore, instead of using '[A-Z]' to represent caps, I should > have used (?) the Posixly Correct, '[:upper:]'. POSIX 2001 and 2008 says that [A-Z] when used as a glob or as a regex is defined _only_ in the C locale; in all other locales, it's behav

Re: Problem with Bash regex test case sensitivity

2010-12-04 Thread Lee
On 12/4/10, Lee Rothstein wrote: > On 12/4/2010 10:06 AM, Corinna Vinschen wrote: > > > On Dec 4 10:05, Lee wrote: > > >> On 12/3/10, Eric Blake wrote: > >>> Read the FAQ. http://www.faqs.org/faqs/unix-faq/shell/bash/, E9. > > >> Which says the en_US locale collates the upper and lower case

Re: Problem with Bash regex test case sensitivity

2010-12-04 Thread Andy Koppe
On 4 December 2010 21:08, Lee wrote: > So...  the reason for setting LANG is a shorthand method of setting > all the LC_xxx environment variables? Yes. Setting LC_ALL does that too, but the difference between LC_ALL and LANG is that LC_ALL takes precedence over the specific LC_xxx variables, where

Re: Problem with Bash regex test case sensitivity

2010-12-04 Thread Lee Rothstein
On 12/4/2010 10:06 AM, Corinna Vinschen wrote: > On Dec 4 10:05, Lee wrote: >> On 12/3/10, Eric Blake wrote: >>> Read the FAQ. http://www.faqs.org/faqs/unix-faq/shell/bash/, E9. >> Which says the en_US locale collates the upper and lower case >> letters like this: >> AaBb...Zz >> I got

Re: Problem with Bash regex test case sensitivity

2010-12-04 Thread Lee
On 12/4/10, Corinna Vinschen wrote: > On Dec 4 10:05, Lee wrote: >> On 12/3/10, Eric Blake wrote: >> > Read the FAQ. http://www.faqs.org/faqs/unix-faq/shell/bash/, E9. >> >> Which says the en_US locale collates the upper and lower case letters like >> this: >> AaBb...Zz >> >> I got that mu

Re: Problem with Bash regex test case sensitivity

2010-12-04 Thread David Sastre
On Sat, Dec 04, 2010 at 10:05:42AM -0400, Lee wrote: > > On 12/03/2010 07:11 PM, Lee wrote: > > why put the local > defaults in ~/.bashrc? My understanding is that ~/.bashrc is called > at every shell startup. Seems like that's one of those things that > just needs to be set in the login shell,

Re: Problem with Bash regex test case sensitivity

2010-12-04 Thread Corinna Vinschen
On Dec 4 10:05, Lee wrote: > On 12/3/10, Eric Blake wrote: > > Read the FAQ. http://www.faqs.org/faqs/unix-faq/shell/bash/, E9. > > Which says the en_US locale collates the upper and lower case letters like > this: > AaBb...Zz > > I got that much :) What I don't get is why someone woul

Re: Problem with Bash regex test case sensitivity

2010-12-04 Thread Lee
On 12/3/10, Eric Blake wrote: > On 12/03/2010 07:11 PM, Lee wrote: >>> Or, is this a bug? > > No, but a "feature" of your locale. Set 'export LC_COLLATE=C', and use > LANG rather than LC_ALL for all your other locale defaults, in your > ~/.bashrc if you don't like it. Nice tip - thank you. But

Re: Problem with Bash regex test case sensitivity

2010-12-03 Thread Eric Blake
On 12/03/2010 07:11 PM, Lee wrote: >> Or, is this a bug? No, but a "feature" of your locale. Set 'export LC_COLLATE=C', and use LANG rather than LC_ALL for all your other locale defaults, in your ~/.bashrc if you don't like it. > > Welcome to the new world order :-0 I tried to figure out why

Re: Problem with Bash regex test case sensitivity

2010-12-03 Thread Lee
On 12/3/10, Lee Rothstein wrote: > Having some problems with bash case-sensitive regexes, so I wrote > this little test. ... snip ... > Do I have some Bash or Cygwin parameter set that engenders case > insensitivity? Probably the same thing I ran into with LANG != C try this little test: $ c

Re: Problem with Bash regex test case sensitivity

2010-12-03 Thread Greg Chicares
On 2010-12-03 22:30Z, Lee Rothstein wrote: [script:] > if [[ "$1" =~ [A-Z] ]] ; then > echo Contains Capital Letters: $1 > else > echo Doesn\'t Contain Capital Letters: $1 > fi [...] > # WTF, O > $ t_regex dfgh > Contains Capital Letters: dfgh Inspect this option: shopt -p | grep nocas