A. N. Other
A. N. Other

Reputation: 489

case-sensitivity in UNIX and Bash

If UNIX is case-sensitive, and I have a directory named ruby in my home directory, and no directory named Ruby, why do

cd ruby 

and

cd Ruby

produce the same result, that is I cd into the ruby directory?

Upvotes: 1

Views: 2561

Answers (1)

heemayl
heemayl

Reputation: 42017

First make sure that they are referring to the same directory. Check the output of:

ls [Rr]uby

If you are sure that they are referring to the same directory, then it could be cdspell builtin of bash that is working here, whose purpose is to correct minor typos in directory names while doing cd. In your case, it is correcting the cases of letter R/r.

You can check whether it is enabled by:

shopt cdspell

Example:

$ cd Ques
bash: cd: Ques: No such file or directory

$ shopt -s cdspell 

$ cd Ques
ques

ques$ shopt cdspell 
cdspell         on

Upvotes: 2

Related Questions