From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12320 invoked by alias); 9 Nov 2011 15:51:17 -0000 Received: (qmail 12143 invoked by uid 22791); 9 Nov 2011 15:51:16 -0000 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 Received: from mail-ww0-f41.google.com (HELO mail-ww0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Nov 2011 15:50:40 +0000 Received: by wwf27 with SMTP id 27so7752363wwf.2 for ; Wed, 09 Nov 2011 07:50:39 -0800 (PST) Received: by 10.216.131.161 with SMTP id m33mr1763146wei.64.1320853839137; Wed, 09 Nov 2011 07:50:39 -0800 (PST) Received: from [172.21.193.102] (85-18-126-22.ip.fastwebnet.it. [85.18.126.22]) by mx.google.com with ESMTPS id a27sm6062532wbp.16.2011.11.09.07.50.37 (version=SSLv3 cipher=OTHER); Wed, 09 Nov 2011 07:50:38 -0800 (PST) Message-ID: <4EBAA14D.7080002@gmail.com> Date: Wed, 09 Nov 2011 15:51:00 -0000 From: Marco Atzeri User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: Pass windows-style paths to the interpreter from the shebang line ? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-11/txt/msg00144.txt.bz2 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