delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/27/03:45:18

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Tue, 27 Mar 2001 10:44:26 +0200
From: Corinna Vinschen <cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Case resolution when searching $PATH
Message-ID: <20010327104426.V1725@cygbert.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20010326220624 DOT 27970 DOT qmail AT web3403 DOT mail DOT yahoo DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <20010326220624.27970.qmail@web3403.mail.yahoo.com>; from fastxc@yahoo.com on Mon, Mar 26, 2001 at 02:06:24PM -0800

On Mon, Mar 26, 2001 at 02:06:24PM -0800, Brett wrote:
> I need to figure out how to make the shell (I use tcsh) impartial to
> case when it searches the $PATH variable for an executable.  I am

tcsh is case sensitive. You can change that slightly by

	set complete = enhance

Take a look into the man page.

> using build scripts which I have no control over which reference MS
> exe's which happen to have all upper case filenames.  Unfortunately
> for me, the scripts use all lower case when calling the executables.
>  This means that the exe's are not found in my path.

You should better use bash for scripting.

> If 'which' behaves like the shell when the shell searches for an
> exec, then I am confused as to its behavior.  Look at this example:
> 
> If I have a file /path/file.exe and /path is in $PATH and I type
> 'which file.exe' I usually get the correct output.  If instead I
> type 'which FILE.EXE' it can't find it.  But if I give which the
> path to the file like so: 'which /path/FILE.EXE' it can resolve it. 
> Why the inconsistency?

Which foo results in searching `foo' in the shell's internal hash table.

If you give a path (which bin/foo) the shell's hash table is not used
but it calls `stat(2)' immediately. Since Windows file systems are case
insensitive the Cygwin internal call finds a file called FOO.

It's not inconsistent, it's simply another mechanism which is used
and that's an obvious behaviour, IMO.

> Another thing, notice above I said I usually get the correct output.
>  I have xemacs in my path and it is found if I type 'which xemacs'
> but NOT 'which xemacs.exe' EVEN THOUGH that is the actual filename
> (case and all) and it is marked executable.  As usual, if I give
> which the full path to xemacs.exe it will recognize that name.  What
> good is a path search if you have to know the path before you
> search???

If you want to change the behaviour of tcsh, feel free to submit a
patch to the tcsh maintainers.

> I have looked through the man page for tcsh and can't find any
> mention of a way to ignore case when searching the path.  I assume
> this is done internal to the shell and I could not circumvent it
> with a script (to lowercase the filename beforehand).

Except for `set complete = enhance'.

> Is there a way I can still get these build script calls resolved
> even though the case doesn't match?

Use bash as script shell. Personally I'm using tcsh as interactive
shell but I would never use it as script shell since the script
language is, uhm, ...

Anyway, if you want to have portable scripts use plain bourne shell
syntax or at least only bash extensions if you really need them.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019