9

I have a issue with case sensitive directory listing in my bash. for example

   $ touch  nohupa nohuPb
   $ ls nohup*
   nohupa  nohuPb

However I do expect it only list nohupa not nohuPb. because nohuPb has capital P. I don't know what variable in my .bashrc set that * works ignore case.

Any idea ?

ARH
  • 1,355
  • 3
  • 18
  • 32

2 Answers2

9

It's nocaseglob that causes that.

nocaseglob
If set, bash matches filenames in a case-insensitive fashion when performing pathname expansion (see Pathname Expansion above).

testing

$ touch fooab fooAb
$ ls
fooAb fooab
$ shopt -s nocaseglob
$ ls fooa*
fooAb fooab
$ shopt -u nocaseglob
$ ls fooa*
fooab
jcollado
  • 39,419
  • 8
  • 102
  • 133
c00kiemon5ter
  • 16,994
  • 7
  • 46
  • 48
2

Looks like your shell has the nocaseglob set. You can unset it by using a shell built-in called shopt. Use -s option to enable it and -u option to disable it.

For more reference you can visit here.

jaypal singh
  • 74,723
  • 23
  • 102
  • 147