Re: Bash glob range [0-5] in UTF-8 locale misses ¹, ² & ³
From:
Duncan Roe
Subject:
Re: Bash glob range [0-5] in UTF-8 locale misses ¹, ² & ³
Date:
Mon, 8 Sep 2025 13:20:02 +1000
Hi Lawrence,
On Sun, Sep 07, 2025 at 09:21:44AM -0400, Lawrence Velázquez wrote:
> On Sun, Sep 7, 2025, at 8:59 AM, Greg Wooledge wrote:
> > The ordering of characters within your locale is controlled by the
> > authors of your locale
>
> To contrast, I'm on macOS:
>
> $ echo $BASH_VERSION
> 5.3.0(11)-maint
> $ locale
> LANG="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_CTYPE="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_ALL=
> $ ls -1
> 0.txt
> 1.txt
> 2.txt
> 3.txt
> 4.txt
> ².txt
> ³.txt
> ¹.txt
> ⁰.txt
> ⁴.txt
> ₀.txt
> ₁.txt
> ₂.txt
> ₃.txt
> ₄.txt
> $ shopt -u globasciiranges
> $ ls -1 [0-5]*
> 0.txt
> 1.txt
> 2.txt
> 3.txt
> 4.txt
>
>
> --
> vq
>
It looks to me like `ls -1` on your system is ignoring the locale.
`ls -1` gives me the exact same output as it does for you after I do
`export LC_COLLATE=C`.
Cheers ... Duncan.