[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Curious case statement error

From: Petr Skočík
Subject: Re: Curious case statement error
Date: Sat, 13 Aug 2016 22:13:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Thanks a a lot. That's useful info. Your suggestions do fix the problem.

On 08/13/2016 09:59 PM, Eduardo Bustamante wrote:
Character ranges are locale-dependant. Check the values of LC_ALL and LC_COLLATE. Under some locales, the [A-Z] range is actually AaBb..Z. That's why it's better to use the character classes, i.e. [[:alpha:]], [[:lower:]], [[:upper:]], etc.

Unless you set the globasciiranges shopt:

If set, range expressions used in pattern matching bracket expressions (see Pattern Matching) behave as if in the traditional C locale when performing comparisons. That is, the current locale’s collating sequence is not taken into account, so ‘b’ will not collate between ‘A’ and ‘B’, and upper-case and lower-case ASCII characters will collate together.

Anyways, bash behavior here is correct. If you need some specific collation order make sure to set your LC_* variables correctly, or use the POSIX locale (LC_ALL=C)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]