Once upon a time, Bill Watson <[EMAIL PROTECTED]> said:
> Ok, maybe I missed a memo 5-10 years ago, but why does
> # ls [A-Z]*
This is shell globbing, and case-(in)sensitivity depends on your locale
settings (LC_COLLATE specifically). The default for en_US.* (I don't
know about other languages) is case insensitive.
> # ls | grep [A-Z]
This is a regular expression, and they are always case sensitive unless
you specify otherwise (it also doesn't anchor to the beginning of the
string, so you'd get any file with an upper-case letter).
Note however, you could get suprising results from the second command,
as an unquoted [A-Z] will still be globbed by the shell first. If there
is no match, it passes [A-Z] to the command directly; if there is a
match (for example, if there is a file named A), it would be expanded
and you'd get the same thing as ls | grep A. You should always quote
anything that contains shell special characters (e.g. [](){}*? off the
top of my head).
> Is there any ls command switch that sorts in 01..89AB..YZab..yz order
> instead of aAbBcC order? Would this cause the first ls command to work if
> there was? (work defined as give me the uppercase filenames)
export LC_COLLATE=C
The C locale is the default for older platforms. You can change just
the sort order (leaving your locale as en_US.UTF-8 for example) by
setting LC_COLLATE.
--
Chris Adams <[EMAIL PROTECTED]>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.
_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list