[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: case insensitive ls listing?



On Tue, 29 Mar 2005 11:10:34 -0500, Kamaraju Kusumanchi
<kk288@cornell.edu> wrote:
> This is one of my long standing problems. Is there a way to make the
> listing of ls case insensitive?
> 
> for example if in a directory, I do
> 
> ls -someoption tem
> 
> it should show all the files such as
> 
> tem, Tem, tEm, TEm, TeM, TEM etc...
> 
> I could not find such an option in the default ls. Is there any enhance
> ls package which does this? or can the default ls be manifested to do this?
> 
> I can always do
> 
> ls [tT][eE][mM]
> 
> but that is too cumbersome to type and errorprone.
> 

Assuming you're using bash, you can use 'shopt' (shell options) to set
the nocaseglob value.

Add it to your bash profile to set it on login, and you'll be set.

dclarke@halifax:~$ shopt -u nocaseglob  # (default setting is off)
dclarke@halifax:~$ ls document* -ad
documents

dclarke@halifax:~$ shopt -s nocaseglob
dclarke@halifax:~$ ls document* -ad
Documents  documents

-- 
~ Darryl  ~ smartssa@gmail.com
http://smartssa.com / http://darrylclarke.com
International Clean Your Windows Day - April 22, 2005
http://pileofcrap.org/news/2096/



Reply to: