delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/11/23/06:16:49

From: cgf AT cygnus DOT com (Christopher Faylor)
Subject: Re: script execution bug
23 Nov 1998 06:16:49 -0800 :
Message-ID: <19981123084716.A6227.cygnus.cygwin32.developers@cygnus.com>
References: <uww4qtsxk DOT fsf DOT cygnus DOT cygwin32 DOT developers AT parvati DOT will DOT or DOT jp>
Mime-Version: 1.0
To: DJ Delorie <dj AT delorie DOT com>, cygwin32-developers AT cygnus DOT com

On Mon, Nov 23, 1998 at 08:35:46AM -0500, DJ Delorie wrote:
>Kazuhiro Fujieda wrote:
>> For example,
>> $ echo '#!/usr/local/bin/bar' > /usr/local/bin/foo
>> $ echo '#!/sh' > /usr/local/bin/bar
>> $ /usr/local/bin/foo
>> /usr/local/bin/C:\usr\local\bin\bar: Can't open /usr/local/bin/C:\usr\local\bin\bar
>
>Be careful with recursive #! usage.  Most unixes, if they work at all, will
>use the interpreter from the second script as the interpreter of the first
>script, but will not actually *run* the second script to interpret
>the first.  For example:
>
>foo:
>#!/bin/sh
>exec perl5 -w $*
>
>bar:
>#!/tmp/foo
>for ($i=0;$i<$#ARGV;$i++) { print $ARGV[$i], "\n"; }
>
>$ ./bar        
>./bar[2]: syntax error at line 2 : `(' unexpected

That's right.  The current behavior is broken but "fixing" it will probably
still not make it do anything very useful.

-chris

- Raw text -


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