-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[EMAIL PROTECTED] wrote:
| In my Linux class last night we were doing a review my typed in ls -m
| [-d-p]* which returned the file Dog. Can anyone explain how this works?
| The -m I understand places commas between the file names. I was under
| the impression that [-d-p] would return any character between d and p
| and that this statement is case sensitive. The * means that can be any
| number of those characters. If could explain this as to why it returns
| Dog I would be grateful, because my teacher doesn't have a clue why it
| does that. Thanks.

Well, don't know what they're teaching you in that class of yours (we've
had this discussion before Dallin :), but that's not quite correct. Let
me break it down:

- -m, you got this part right
[d-p], matches any of d..p (case sensitive)
[-d-p], matches '-' or any of d..p (case sensitive)
*, matches any number of any character (doesn't refer to the previous
atom the way regexes do)

So ls -m [-d-p]* will match any filename beginning with '-' or a
character between 'd' and 'p' (case sensitive).

The interesting thing is, it still shouldn't match against Dog (for me
it doesn't).

bash-2.05b$ ls
Dog  dog
bash-2.05b$ ls -m [-d-p]*
dog

Could it possibly be that Dog is inside of a subdirectory of the current
directory and that the subdirectory name matches the pattern?

bash-2.05b$ ls match
Dog  dog
bash-2.05b$ ls -m [-d-p]*
Dog, dog

If this isn't the case (Dog is itself in the directory being ls'ed),
this is truly funky behavior. What distro are they using?

Jacob Fugal
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/2fJt/PO7QochUiQRAqTZAJ9IH9tC+ftkSneEwoPu+BC+DjqBeACeIapg
BNERMQ4jaUM0aCSQKpSjvaM=
=mXIL
-----END PGP SIGNATURE-----


____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to