Add a New Comment (Rich Markup)
Not a bug. That's just how character sets work. If you want the set of upper case characters, use [:upper:]. The locale specifies the ordering, so I guess under this locale, [A-Z] means: [AbBcCdD..zZ], that's why it doesn't match 'a'. The only locale guaranteed to have that ordering for ranges ([a-z], [A-Z], ...) is the POSIX locale (LANG=C or LANG=POSIX)
My attempt to use markup formatting appears to have caused the web interface to not display the text, so here is the plain version (minus the first line, which did come through). My apologies if this is redundant. The demonstration: $ cat Demo # shell script for i in "$@"; do case "$i" in [A-Z]) echo "$i has upper case";; esac done $ env - LANG=en_US.UTF-8 ./bash ./Demo a b C y z b has upper case C has upper case y has upper case z has upper case $ This was tested with a fresh-compiled build from the latest git tip on 64-bit Ubuntu 14.04. I can (re)produce this behavior in at least Bash 4.3.11 (Ubuntu 14.04), 4.2.47 (Fedora 20), and 4.2.25 (Ubuntu 12.04). Assuming that it is desirable for '*[A-Z]*' to match lower case characters at all in this context (I believe that it is a mistake to do so and it certainly doesn't match the behavior of other POSIX-compatible shells), bash should at least match 'a' too. A mirror image of this bug happens if you use '*[a-z]*' and test against upper case letters; 'Z' does not match although A-Y do.
It's easiest to show this as a demonstration:
$ cat Demo # shell script for i in "$@"; do case "$i" in *[A-Z]*) echo "$i has upper case";; esac done $ env - LANG=en_US.UTF-8 ./bash ./Demo a b C y z b has upper case C has upper case y has upper case z has upper case $ +verbatim+ This has been reproduced with a build from the latest git tip. Assuming that it is desirable for '*[A-Z]*' to match lower case characters at all in this context (I believe that it is a mistake to do so), bash should at least match 'a' too. There is a symmetrical issue if you match '*[a-z]*' where 'Z' does not match although A-Y do.
(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)
Attach Files: Comment:
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Only logged-in users can vote.
Please enter the title of George Orwell's famous dystopian book (it's a date):
Follow 2 latest changes.
Copyright © 2023 Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. The Levitating, Meditating, Flute-playing Gnu logo is a GNU GPL'ed image provided by the Nevrax Design Team. Source Code
Powered by Savane 3.12