delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_YG |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <4EBAA14D.7080002@gmail.com> |
Date: | Wed, 09 Nov 2011 16:50:37 +0100 |
From: | Marco Atzeri <marco DOT atzeri AT gmail DOT com> |
User-Agent: | Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Pass windows-style paths to the interpreter from the shebang line ? |
References: | <j9dvqh$u92$1 AT dough DOT gmane DOT org> |
In-Reply-To: | <j9dvqh$u92$1@dough.gmane.org> |
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 |
On 11/9/2011 2:39 PM, 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 ? > > Thank you, > Timothy Madden > you need to use cygpath to convert posix path in window path You could make a php.sh script like this to invoke your php.exe with a window path ---------------------------------------------------------- #!/bin/bash for i in $(echo $PATH | tr ':' ' ') do a=$(find $i -name $1 -exec cygpath -w \{\} \; ) if ( [ "$a" != "" ] ) ; then /full_cygwin_path/php.exe $a exit fi done ---------------------------------------------------------- Regards Marco -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |