[Bug 256473] FreeBSD shells are case insensitive for character ranges

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 08 Jun 2021 16:57:34 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256473

--- Comment #6 from Jason W. Bacon <jwb_at_freebsd.org> ---
(In reply to Stefan E├čer from comment #4)

>> FreeBSD coral.acadix  bacon ~/Test 1032: ls
>> aardvark  Alan      Bob       zip
>> FreeBSD coral.acadix  bacon ~/Test 1033: ls -d [A-Z]*
>Alan  Bob   zip

>This is to be expected. The sequence is: "AaBb..Zz" and you are selecting for >all initial letters except for the files starting with "z" (which comes after >"Z").

I see the pattern now, but your range expansion above is incorrect and doesn't
agree with the ls output I provided.

The lower case letters actually come first, which is not what I expected
either.  That's why the output seemed inexplicable at first.

[A-Z] == [AbB..zZ] == all letters except 'a'
[a-z] == [aAbB..z] == all letters except 'Z'

[A-Z]* selects for all but those that start with 'a', not 'z'.  This explains
why zip is listed and aardvark is not.

Adding one more file to clarify:

FreeBSD coral.acadix  bacon ~/Test 1013: ls
aardvark  Alan      Bob       Zed       zip

FreeBSD coral.acadix  bacon ~/Test 1014: ls -d [A-Z]*
Alan  Bob   Zed   zip

FreeBSD coral.acadix  bacon ~/Test 1015: ls -d [a-z]*
aardvark  Alan      Bob       zip

FreeBSD coral.acadix  bacon ~/Test 1020: ls -d [A-z]*
Alan  Bob   zip

FreeBSD coral.acadix  bacon ~/Test 1021: ls -d [a-Z]*
aardvark  Alan      Bob       Zed       zip

globasciirnages appears to be on by default in the bash port (not from anything
in my env), but disabling with with shopt -u does make bash behave like tcsh.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Tue Jun 08 2021 - 16:57:34 UTC

Original text of this message