Aus: http://cnswww.cns.cwru.edu/~chet/bash/COMPAT
...
13. The behavior of range specificiers within bracket matching expressions
in the pattern matcher (e.g., [A-Z]) depends on the current locale,
specifically the value of the LC_COLLATE environment variable. Setting
this variable to C or POSIX will result in the traditional ASCII behavior
for range comparisons. If the locale is set to something else, e.g.,
en_US (specified by the LANG or LC_ALL variables), collation order is
locale-dependent. For example, the en_US locale sorts the upper and
lower case letters like this:
AaBb...Zz
so a range specification like [A-Z] will match every letter except `z'.
Other locales collate like
aAbBcC...zZ
which means that [A-Z] matches every letter except `a'.
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).
You can find your current locale information by running locale(1):
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.
...
OsunSeyi schrieb:Ich stelle immer wieder, sowohl bei egrep als auch sed, fest, daß der Ausdruck:
[A-Z] nicht korrekt funktioniert und bin gezwungen
[ABCDEFGHIJKLMNOPQRSTUVWXYZ] zu benutzen.
Wie kann das denn sein ?????