From: Andrey Repin <anrdaemon@freemail.ru>
To: Timothy Madden <terminatorul@gmail.com>, cygwin@cygwin.com
Subject: Re: Pass windows-style paths to the interpreter from the shebang line ?
Date: Thu, 10 Nov 2011 14:20:00 -0000 [thread overview]
Message-ID: <992045008.20111110181431@mtu-net.ru> (raw)
In-Reply-To: <j9g9rn$hfh$1@dough.gmane.org>
Greetings, Timothy Madden!
> As Linda said, I would like to be able to execute my new script from a
> cygwin prompt and from a sh script, with a command like
> parseLog.php /logfile/
Fine.
> For this to work, I think I need the shebang line.
For cygwin, seems so.
> So I tried "#! php"
> too, the problem is that bash will then invoke the following command to
> process my script:
> php /home/adrian/usr/local/bin/parseLog.php
Yep. I haven't run into this issue myself, due to executing scripts from
current directory at all times... *shrugs*
> Now remember that "php" here is the native Windows port that can not
> read that cygwin filename argument, begining with /home/adrian/...
The problem is not limited to php invocation, but also imposing restrictions
to the script usage.
If invocation issue could be solved by something like
$ cat /usr/bin/php
#! /bin/sh
/c/usr/php-win32/php.exe `cygpath --mixed $1` $*
You'd have to deal with PHP arguments as well.
Simple solution to the latter I could think about is to write a PHP library
converting Cygwin paths into native windows paths, where you know you need
them. Not where some supposedly sophisticated utility thinks you have them.
> The solutions I could think of include:
> - compose a script named php, somewhere on PATH, written is sh,
> perl, python, even php,
Naaah, you'd run into loop with PHP. :)
> - get a cygwin port of php, that understands cygwin-style paths
> given on the command line. Although Cygwin setup.exe did not
> install such a port, I am happy to find here that there still
> is a cygwin port of php available.
There's pros and cons to use Cygwin ports when there's native version of the
same application is available.
> - have the cygwin port of bash detect if the
> interpreter binary from any shebang line is a cygwin
> application or a native application and compose the command
> line accordingly. Corinna Vinschen on this list says this is
> not as easy as it sounds, though
Yep, it's not. Especially not if there's a custom loader in executable.
P.S.
Mixed paths would be safer to use inside Cygwin scripts. Just avoid using your
script with network share through UNC... :/
--
WBR,
Andrey Repin (anrdaemon@freemail.ru) 10.11.2011, <16:15>
Sorry for my terrible english...
--
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
prev parent reply other threads:[~2011-11-10 14:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-09 13:40 Timothy Madden
2011-11-09 15:30 ` Corinna Vinschen
2011-11-09 15:46 ` Jeremy Bopp
2011-11-09 15:51 ` Corinna Vinschen
2011-11-10 1:14 ` PHP (was: Re: Pass windows-style paths to the interpreter from the shebang line ?) Yaakov (Cygwin/X)
2011-11-10 10:05 ` Corinna Vinschen
2011-11-09 21:16 ` Pass windows-style paths to the interpreter from the shebang line ? Timothy Madden
2011-11-09 21:20 ` Christopher Faylor
2011-11-09 15:51 ` Jeremy Bopp
2011-11-10 1:35 ` Andrey Repin
2011-11-09 16:27 ` Andrew DeFaria
2011-11-09 15:51 ` Marco Atzeri
2011-11-10 1:35 ` Andrey Repin
2011-11-10 9:46 ` Linda Walsh
2011-11-10 10:43 ` Timothy Madden
2011-11-10 14:20 ` Andrey Repin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=992045008.20111110181431@mtu-net.ru \
--to=anrdaemon@freemail.ru \
--cc=cygwin@cygwin.com \
--cc=terminatorul@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).