This is the mail archive of the
mailing list for the Cygwin project.
Re: problem with finding case-sensitive filenames when running DOS batch command with bash shell
On Wed, 6 Oct 2004, Igor Pechtchanski wrote:
> On Wed, 6 Oct 2004, DFong wrote:
> > Hi,
> > I'm running cygwin bash shell and have set
> > the parameters
> > ~/.bashrc
> > shopt -s nocaseglob
> > ~/.inputrc
> > set completion-ignore-case on
> > but I'm still having problems with running a DOS batch command that will
> > not be case-sensitive.
> > x.bat
> > dir /s /b filename.txt (I want it to match with name like fileNAME.txt
> > and return filename.txt)
> > If I run this x.bat under cygwin bash shell
> > the return from dir /s /b command is "file not found".
> > What else do I need to set in DOS or bash shell environment to allow
> > "dir /s /b" to make the directory search for filename to be
> > case-insensitive?
> > David
> Bash doesn't know about batch files, so when you attempt to run one, it
> interprets it as a shell script. By coincidence, there is a "dir" command
> under Cygwin (a form of 'ls'), so what it ends up doing is looking for
> files named "s" and "b" in your root directory.
> You can confirm this in many ways, the simplest being to remove spaces
> between "dir" and the switches (i.e., use "dir/s/b"). This shouldn't
> affect the batch file (since cmd.exe treats "/" as an argument separator),
> but will produce an error in bash.
> Use "cmd /c x.bat" or "command.com /c x.bat" to run batch files.
Whoops, sorry, I'm wrong. The .bat file is executed properly. Sorry for
sending the e-mail off without checking -- don't know what came over me.
However, your example above also works for me (though not quite like you
want it to). The case of filename.txt is adjusted to the case on the
disk, rather than the case of the argument. If that's not the problem,
you'll have to be more specific about the error that you get and the exact
steps to reproduce it.
|\ _,,,---,,_ email@example.com
ZZZzz /,`.-'`' -. ;-;;,_ firstname.lastname@example.org
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing." -- Dr. Jubal Harshaw
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html