[PLUG] bash surprise
Zot O'Connor
zot at whiteknighthackers.com
Fri Feb 13 11:11:02 UTC 2004
On Fri, 2004-02-13 at 10:47, Bill Spears wrote:
> Try this:
> $ echo B | grep [a-z]
>
> Cure seems to be LC_ALL=C.
>
This is a grep issue:
man grep:
Within a bracket expression, a range expression consists of two charac-
ters separated by a hyphen. It matches any single character that sorts
between the two characters, inclusive, using the localeâs collating
sequence and character set. For example, in the default C locale,
[a-d] is equivalent to [abcd].
>>>>>>>>
Many locales sort characters in dictio-
nary order, and in these locales [a-d] is typically not equivalent to
[abcd]; it might be equivalent to [aBbCcDd], for example. To obtain
the traditional interpretation of bracket expressions, you can use the
C locale by setting the LC_ALL environment variable to the value C.
> I thought my system, Fedora1, was plain Jane vanilla. The fact that
> this wasn't set right really surprised me.
--
Zot O'Connor
http://www.ZotConsulting.com
http://www.WhiteKnightHackers.com
More information about the PLUG
mailing list