delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/11/09/08:40:09

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RP_MATCHES_RCVD,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Timothy Madden <terminatorul AT gmail DOT com>
Subject: Pass windows-style paths to the interpreter from the shebang line ?
Date: Wed, 09 Nov 2011 15:39:29 +0200
Lines: 26
Message-ID: <j9dvqh$u92$1@dough.gmane.org>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

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 ?

Thank you,
Timothy Madden


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