> It's worth noting here that bash's globbing of '[A-Z]*' etc is > definitely different from the system collation sequence (i.e. using > fnmatch() or glob() functions). There is an open bug report about this > here:
On the contrary, the bash globbing of [A-Z] is using exactly the system's collating sequence. Bash uses strcoll; glibc/python probably use character value comparisons for old-style bracket range expressions. Running the attached program like asort -v {a..z} {A..Z} will give you the current locale and show how the arguments sort. I get $ ./asort -v {a..z} {A..Z} default locale = en_US.UTF-8 a A b B c C d D e E f F g G h H i I j J k K l L m M n N o O p P q Q r R s S t T u U v V w W x X y Y z Z $ LC_ALL=en_US ./asort {a..z} {A..Z} a A b B c C d D e E f F g G h H i I j J k K l L m M n N o O p P q Q r R s S t T u U v V w W x X y Y z Z This shows the collating sequence for alphabetics in the en_US locale. (Since I don't set LC_ALL anywhere in my startup files, my system's default locale is apparently en_US.UTF-8.) Chet
#include <stdio.h> #include <locale.h> #include <string.h> #include <stdlib.h> #include <unistd.h> static int qsort_strcmp(s1, s2) char **s1, **s2; { return (strcoll(*s1, *s2)); } static void usage() { fprintf(stderr, "asort: usage: asort [-v] args\n"); } int main(c, v) int c; char **v; { int i, verbose; char *dlocale; verbose = 0; while ((i = getopt(c, v, "v")) != -1) { switch (i) { case 'v': verbose = 1; break; case '?': default: usage(); exit(2); } } c -= optind; v += optind; dlocale = setlocale(LC_ALL, ""); if (verbose) printf("default locale = %s\n", dlocale ? dlocale : "''"); qsort(v, c, sizeof(char *), qsort_strcmp); for (i = 0; i < c; i++) { printf("%s ", v[i]); } printf("\n"); exit(0); }
``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://tiswww.tis.case.edu/~chet/
_______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash