From: DJ Delorie Subject: Re: script execution bug 23 Nov 1998 08:35:46 -0500 Message-ID: <365964B2.6CB01688@delorie.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5 [en] (X11; I; Linux 2.1.126 i586) X-Accept-Language: en 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