Subject: !# breaks foreign interpreter (cygnus script path)
From: [email-masked]

15 Dec 1998 18:11:02 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
To: [email-masked]

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

[email-masked]

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".