MLUG: [MLUG] case sensitivity in 'ls' command
[MLUG] case sensitivity in 'ls' command
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
>From time to time I wish to do a directory listing for a file where the 
name contains a string that might be upper case, lower case, or mixed 
case, and I'm not sure which it is.  The last time this happened to me, I 
was searching a directory of old e-mail attachments for files with .doc 
extensions, but they could have had .DOC extensions or even, conceivably, 
.Doc.  I could have tried one of these:

ls dirname/*.doc dirname/*.DOC dirname/*.Doc
ls dirname/*.{doc,DOC,Doc}
ls dirname/*.[Dd][Oo][Cc]

but it would have been nicer if I could have turned off case sensitivity 
and done this:

lsi dirname/*.doc

or, if I wanted to avoid listing .doc files in DIRNAME and Dirname, I 
could have done this:

cd dirname ; lsi *.doc

Unfortunately, I think there is no such thing as the lsi command or ls 
with case insensitivity, so I end up doing this kind of thing:

ls -lA dirname | grep -i '\.doc$'

Is that the best we can do?  Will 'ls' never have a case insensitivity 
option?

Mike
_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members