Mail Archives: cygwin/2000/10/26/10:12:15
In the Cygwin/bash environment, is it possible to write a single Perl
script
such that
1. You invoke the script simply by naming it, without saying 'perl ...':
script
option: it would be ok if it had to be called via:
script.pl
or
script.plx
2. The script uses the perl.exe that it finds in the $PATH,
rather than hard-coding it on the first line. E.g. the following
preamble inside the script works on UNIX but I'm having trouble making it
work under bash/cygwin without saying 'perl script ...':
eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}'
&& eval 'exec perl -w -S $0 $argv:q'
if 0;
The classic
#!/usr/local/bin/perl -w
is undesirable because I might want to switch perl's easily, e.g. by
changing $PATH. Also, this script might run at many sites and
there are a lot of UNIX system admin's I would have
to ask to put perl in my favorite place.
3. The mechanism used to accomplish 1. and 2. works identically on UNIX
and cygwin/Win9x/WinNT. That is, a single script works in both
environments.
-- I don't want to maintain two versions
-- I don't want to have to write a wrapper every time I write a script
(but perhaps a single generic wrapper would be ok).
If this isn't achievable, I'll probably give up 1. and use:
perl script ...
Michael Fay
Texas Instruments, Santa Barbara
mfay AT ti DOT com
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -