Description of problem: Bash behaving unexpecadly in a case statement. The following test script demonstrates: is_syslib() { case $1 in L[a-z]*) echo "[$1] Begins with L then lower case" ; return 2 ;; [A-Z]*) echo "[$1] Begins with uppercase letter" ; return 0 ;; *) echo "[$1] is probably lowercase" ; return 1 ;; esac } is_syslib DEF is_syslib ad is_syslib in is_syslib mx is_syslib sq Version-Release number of selected component (if applicable): [root@spindhella ~]# bash --version GNU bash, version 3.00.16(1)-release (i386-redhat-linux-gnu) Copyright (C) 2004 Free Software Foundation, Inc. How reproducible: 100% reproducable. Steps to Reproduce: 1. Place the example code above into /tmp/test_bash_bug 2. bash /tmp/test_bash_bug Actual results: [root@spindhella ~]# bash /tmp/tstit [DEF] Begins with uppercase letter [ad] is probably lowercase [in] Begins with uppercase letter [mx] Begins with uppercase letter [sq] Begins with uppercase letter Expected results: [root@spindhella ~]# ksh /tmp/tstit # Korn shell does not exhibit this bug [DEF] Begins with uppercase letter [ad] is probably lowercase [in] is probably lowercase [mx] is probably lowercase [sq] is probably lowercase Additional info: The bug also appears in 2.05a.0 version of bash on RH 7.3 # bash --version GNU bash, version 2.05a.0(1)-release (i686-pc-linux-gnu) Copyright 2001 Free Software Foundation, Inc. Both the AT&T ksh (sh (AT&T Labs Research) 1993-12-28 q) and pdksh produce the expected output. On HPUX 10.20: sh, ksh and bash v 2.04.0 produce the expected output.
Created attachment 128149 [details] Test Script
[A-Z] only means 'upper case letters' in the C locale. In all other locales, it means A through to Z (as you would see list in dictionary or a book's index). The glob for 'any upper case letter' is '[[:upper:]]'. See the 'Pattern Matching' section of 'Pathname Expansion' in the bash man page.