delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/11/09/10:30:45

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 9 Nov 2011 16:29:44 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Pass windows-style paths to the interpreter from the shebang line ?
Message-ID: <20111109152944.GK15154@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <j9dvqh$u92$1 AT dough DOT gmane DOT org>
MIME-Version: 1.0
In-Reply-To: <j9dvqh$u92$1@dough.gmane.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Nov  9 15:39, Timothy Madden wrote:
> Hello
> 
> I would like to write a php script to run from my cygwin command line.
> I have the php CLI executable (php.exe) in PATH and I use
> 	#!/bin/env php
> as the first line of the .php script, and make it executable.
> 
> The problem is that bash will than invoke the Win32 native php.exe
> binary with the Cygwin-style path of my script as the argument,
> and then php complains that it:
> 
> `Could not open input file: /home/Adrian/usr/local/bin/parseLog.php´
> 
> Which is normal for php.exe, as it does not understand cygwin paths.
> 
> I found no way around this problem. I would type `php /scriptname/´
> myself but then the script name would no longer be searched on PATH
> and I would have to type
> 'D:\Local\cygwin\home\Adrian\usr\local\bin\parseLog.php' as the
> script name at all times.
> 
> Is there a way around this ? Can cygwin detect the executable is not
> a cygwin application add pass in the right path name ?

That's not as easy as it may sound.  What about creating wrapper scripts
with the same name in another dir and put that dir in front of the other
bin dir in $PATH?  The wrapper scripts could be shell scripts which use
`cygpath -wa' to convert the path to DOS notation and then call php.

I'm surprised that we don't have php in the Cygwin distro.  Did nobody
try to port php to Cygwin yet?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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