Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh portable script

On Tue, 13 Jul 2010, Peter Stephenson wrote:

> On Mon, 12 Jul 2010 17:06:48 +0100 Peter Stephenson wrote:
> > Looking at the responses, on which I can't improve, one might 
> > speculate it was time for someone to implement path searching down 
> > in the #! handler for relative paths.
> >...
> > This doesn't really touch zsh except that we could do it in our own 
> > #! handler (see zexecve() in Src/exec.c).w
> Straightforward, not sure if anyone's interested since this only 
> addresses a fairly tiny part of the problem...
> Note if zsh is in the current directory it tries that first.  That 
> maintains compatibility with how it used to work (whether 
> intentionally or not).
> % cat execme 
> #!zsh -f
> print I am running under $ZSH_VERSION
> % PATH=/bin ./execme
> I am running under 4.3.10
> % PATH=/usr/local/bin ./execme
> I am running under 4.3.10-dev-1

I don't quite understand... what does this improve?  Doesn't the script 
already have to be running under Zsh for this to have any effect?

How do most systems handle basenames in shebangs?

Using the same set of shells that I was using to test the 
weird-numbers-of-backslashes thing that came up not too long ago, only 
the decidedly non-standard psh, sash, and shish don't completely barf on 
it.  And even those three don't use it:

zsh$ cat test.script
#!zsh -f
zsh$ for l in {ba,z,c,tc,,k,fi,p,da,mk,sa,shi,po}sh ; $l -c ./test.script && echo ok $l || echo nok $l
nok bash
nok zsh
nok csh
nok tcsh
nok sh
nok ksh
nok fish
ok psh
nok dash
nok mksh
ok sash
ok shish
nok posh
zsh$ for l in {p,sa,shi}sh ; $l -c ./test.script
Error - Could not exec /home/bhaskell/tmp/testshebang/test.script.
[1] Error 20533 ./test.script
./test.script: No such file or directory
shish: shish: ./test.script: Success

Messages sorted by: Reverse Date, Date, Thread, Author