Unexpected output from 'ls' when using glob expressions
I get the following output when running the command 'ls [A-M]*' in one of my directories:
and just because I was interested I ran 'ls [a-m]*' in the same dir and got the following:
So, it looks like the lower-case version of the command works, but what about the upper-case version. Why am I getting all those lower-case results? I''m running Mandrake 10.0 by the way.
I've got Red Hat 8, and I see something similar. Both (lowercase and uppercase) can be demonstrated as "broken". I'll give an example in a sec. However, it's not a problem with ls, it's a problem with bash. The shell is supposed to handle wildcard expansion, and then call the command. So ls just sees the list of files that bash says match your fileglob.
Anyway, the experiment I ran was this:
/work/work# touch Makefile
/work/work# touch makefile
/work/work# touch MAkefile
1 . 3 .. 0 MAkefile 0 Makefile 0 makefile
/work/work# ls [a-m]*
/work/work# ls [A-M]*
0 MAkefile 0 Makefile
GNU bash, version 2.03.0(2)-release (i486-pc-linux-gnu)
Copyright 1998 Free Software Foundation, Inc.
keep in mind with the globs, that it'll list directories contents with those starting letters too.
I ran those examples in a completely clean directory; just the three bogus makefiles.
My bash version is a little different:
i just tried it with 2.05a and got the same as i did before. maybe you have some ls alias that's messing things up.
That's a good point, but I checked the output of alias, and nothing is listed for ls:
Thank you for the replies.
DarkHelmet, I actually have the same bash version as you do:
i just compiled 2.05b from fedora core2's source rpm. i didn't apply any of the patches. look at all this crap. i got the same results i got before.
2 . 4 bash-2.05b-rereadline.patch
4 .. 4 bash-2.05b-restrict.patch
4 bash-2.02-security.patch 4 bash-2.05b-slow.patch
4 bash-2.03-paths.patch 4 bash-2.05b-subst.patch
4 bash-2.03-profile.patch 4 bash-2.05b-utf8.patch
4 bash-2.04-compat.patch 4 bash-2.05b-warnings.patch
4 bash-2.05-ia64.patch 4 bash-2.05b-xcc.patch
8 bash-2.05a-interpreter.patch 1504 bash-2.05b.tar.bz2
4 bash-2.05a-loadables.patch 32 bash-completion-20020220.tar.gz
8 bash-2.05a-requires.patch 1436 bash-doc-2.05b.tar.bz2
4 bash-2.05a-shellfunc.patch 20 bash.spec
4 bash-2.05b-003fix.patch 4 bash205b-001
8 bash-2.05b-complete.patch 4 bash205b-002
4 bash-2.05b-debuginfo.patch 4 bash205b-003
4 bash-2.05b-display.patch 4 bash205b-004
8 bash-2.05b-locale.patch 4 bash205b-005
4 bash-2.05b-manso.patch 4 bash205b-006
4 bash-2.05b-mbinc.patch 4 bash205b-007
4 bash-2.05b-overread.patch 4 dot-bash_logout
4 bash-2.05b-pgrp_sync.patch 4 dot-bash_profile
4 bash-2.05b-readline-init.patch 4 dot-bashrc
this is the only file i used from it.
|All times are GMT -5. The time now is 08:36 AM.|