delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/02/07:57:10

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
X-Apparently-From: <earnie?boyd AT yahoo DOT com>
Message-ID: <3AC86900.BA28372C@yahoo.com>
Date: Mon, 02 Apr 2001 06:56:48 -0500
From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
Reply-To: Earnie Boyd <cygwin AT cygwin DOT com>
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Jan Vicherek <cygwin-user AT ied DOT com>
CC: "Larry Hall (RFK Partners, Inc)" <lhall AT rfk DOT com>,
Andrew Markebo <flognat AT flognat DOT myip DOT org>,
Earnie Boyd <cygwin AT cygwin DOT com>
Subject: Re: Batch files
References: <Pine DOT LNX DOT 4 DOT 21 DOT 0103301738200 DOT 14975-100000 AT ann DOT ied DOT com>

Jan Vicherek wrote:
> 
>   Hmm, executing "foo.bat" works even without performing the three steps
> below, but executing "foo" (where "foo.bat" is in the path), doesn't work
> even if "#!.exe" is present ! :
> 
> administrator AT BM80258908 /c
> $ echo $PATH
> /c/temp:.:/bin:/usr/bin:/sbin:/usr/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin:/cygdrive/c/WINNT/system32:/cygdrive/c/WINNT:/cygdrive/c/vim/vim57
> 
> administrator AT BM80258908 /c
> $ foo.bat
> 
> c:\>echo test works !
> test works !
> 
> administrator AT BM80258908 /c
> $ foo
> bash: foo: command not found
> 
>  I presume that in order to make the three steps of the effect that
> executing just "foo" will work, there is a prerequisite, right ?
> Earnie, what would this prerequisite be ?
> 

The prerequisite is that you have to live by the Win32 rules.  The only
way for the #! suggestion to work is to name the file foo.bat and
execute foo.bat.  All of this quibble over not specifying all of the
filename is just nonsense.  Where in UNIX land do you get filename
extension recognition?  IMO, the executing foo.exe by the name foo is
bogus too as well as the .exe that is put there but if I want to play
with cmd.exe/command.com they have to be.

I don't see that executing foo if the file is named foo.bat exists will
easily work.  It already confuses autoconfiguration with foo.exe
stat'ing as foo.  If we change the routines to find foo.bat as foo then
when we have foo.exe, foo.bat and foo/ in the same directory what does
stat() stat?

My recommendation is to live with it.  Needing to type foo.bat when you
want to execute foo.bat is here to stay.  If you want to be lazy use the
tab-completion routines of the readline library.

Earnie.

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
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