delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/22/08:29:16

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-WebMail-UserID: pjacklam AT online DOT no
Date: Fri, 22 Feb 2002 14:26:43 +0100
From: pjacklam <pjacklam AT online DOT no>
To: cygwin AT cygwin DOT com
X-EXP32-SerialNo: 50000140
Subject: Re: /usr/bin/env - Incorrect parsing of #! line? Something that works!
Message-ID: <3C77FCA6@epostleser.online.no>
Mime-Version: 1.0
X-Mailer: InterChange (Hydra) SMTP v3.62

I did, finally, find two solutions which work on both
Cygwin and Solaris, which is pretty much all I need.
In case someone is interested, here are the solutions.

Alternative 1
=============
This forces the script to be interpreted by "sh".
        :
        eval 'exec perl -wS $0 ${1+"$@"}'
          if 0;

I am not sure why replacing ":" with "#!/bin/sh" doesn't
work though, but doing so gives on Solaris
"-wS: bad option(s)" and on Cygwin: "Illegal option -w".

Alternative 2
=============
This checks to see what kind of syntax the running shell
accepts (Bourne shell style or C shell style) and then
calls perl in a way appropriate for the running shell.

        eval '(exit $?0)' && eval 'exec perl -wS $0 ${1+"$@"}'
        & eval 'exec perl -wS $0 $argv:q'
          if 0;

Peter

-- 
Peter J. Acklam - pjacklam AT online DOT no - http://home.online.no/~pjacklam


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019