Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: From: "Fay, Michael" To: "'cygwin AT sourceware DOT cygnus DOT com'" Subject: How to write a UNIX/NT portable Perl script Date: Thu, 26 Oct 2000 09:10:45 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" 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