|
From: | Ilkka Virta |
Subject: | Re: anomalous behaviour of ls command |
Date: | Tue, 30 Jan 2018 15:48:34 +0200 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 30.1. 20:54, ken young wrote:
I have a directory with four files A Z a z only. "ls [A-Z]" displays only 3 files A Z z ;a is missing "ls [a-z]" displays only 3 files A a z ;Z is missing
Basically, your locale orders the letters as aAbBcC...yYzZ, so Z comes after z and [a-z] misses it. Similarly for a and [A-Z]. You can see the ordering if you do 'echo *' or such.
'shopt -s globasciiranges' should make [a-z] only match the 26 ASCII lowercase letters, and 'shopt -s nocaseglob' should make the globs match regardless of lettercase (it would also make a* match A).
-- Ilkka Virta / itvirta@iki.fi
[Prev in Thread] | Current Thread | [Next in Thread] |