This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

!# breaks foreign interpreter (cygnus script path)


Hello,
I´m using Beta 20.1 bash,
and I´m also using a non-Cygnus interpreter (Perl, in my case).

I want the bash to fire up that interpreter
through a #! first line in my script, i.e.,
#!/usr/local/bin/perl -w
in my case.

Alas, this sometimes works and it sometimes doesn't.

After a bit of investiagation, I found out what the problem is:

Naturally, bash has to provide the interpreter
with the name of the script. Depending on circumstances,
it sometimes does so using the cygnus
"//(drive letter)/path" - notation.
This notation my interpreter does not comprehend.

As a quick fix, I threw out /usr/local/bin/perl.exe
and replaced it with a shellscript

#!/bin/sh
exec perl \
`for a in $*; do (test -d "$a" -o -f "$a" && cygpath -w "$a") || echo "$a";
 done`

This works in some cases, in particular, in those cases I happen
to be interested in.  (I happen not to use /usr/local/bin/perl
together with shell escapes.  As you can guess from the script,
/usr/local/bin isn't in my $PATH, either.)


For a much more stable fix, I suggest:

When bash is about to fire up an interpreter
through a #! - line, it should analyse that interpreter
to find out wether or not it is a cygnus application.
If it isn't, the script pathname that the bash itself provides
to the interpreter should be given in "windows notation"
rather than "cygnus notation".


If that proves hard to do, than alternatively
a separat redirector programm could be included
with the cygnus user tools.

That redirector should do approximately what my little shell klugde does,
possibly only on the last of the arguments provided,
but certainly in a shell escape - save fashion.

Come to think of it, there might also be some good use
for redirector functionality the other way round,
so one could doubleclick on a file (on any drive)
and have a cygnus programm interpret that file.

Andreas Krüger

ak@mlc.de


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]