[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Change coming in bash-2.05
From: |
Chet Ramey |
Subject: |
Change coming in bash-2.05 |
Date: |
Mon, 20 Nov 2000 13:00:33 -0500 |
Bash-2.05 will revert to the bash-2.03 behavior of honoring the current
locale setting when processing ranges within pattern matching bracket
expressions ([A-Z]). This is what POSIX.2 and SUSv2 specify.
The behavior of the matcher in bash-2.05 depends on the current LC_COLLATE
setting. Setting this variable to `C' or `POSIX' will result in the
traditional behavior ([A-Z] matches all uppercase ASCII characters).
Many other locales, including the en_US locale (the default on many US
versions of Linux) collate the upper and lower case letters like this:
AaBb...Zz
which means that [A-Z] matches every letter except `z'.
The portable way to specify upper case letters is [:upper:] instead of
A-Z; lower case may be specified as [:lower:] instead of a-z.
Look at the manual pages for setlocale(3), strcoll(3), and, if it is
present, locale(1).
If you have locale(1), you can use it to find your current locale
information even if you do not have any of the LC_ variables set:
caleb.ins.cwru.edu(2)$ locale
LANG=en_US
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_ALL=en_US
My advice is to put
export LC_COLLATE=C
into /etc/profile and inspect any shell scripts run from cron for constructs
like [A-Z]. This will prevent things like
rm [A-Z]
from removing every file in the current directory except those beginning
with `z' and still allow individual users to change the collation order.
Users may put the above command into their own profiles as well, of course.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)
Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/
- Change coming in bash-2.05,
Chet Ramey <=