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

Re: zsh portable script



On Tue, 13 Jul 2010 02:46:22 +1200 (NZST)
Atom Smasher <atom@xxxxxxxxxxx> wrote:
> on freebsd, zsh installs as /usr/local/bin/zsh. on linux (and most
> other systems?) it installs as /usr/bin/zsh.
> 
> what's the best way to make zsh script portable between linux and
> freebsd?
> 
> i could start the script with:
>  	#!/usr/bin/env zsh
> 
> or i could specify that the script be executed as:
>  	zsh script
> 
> is there a better way?

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.

  #!zsh
  print "Found zsh in $0".

I don't think it has any misfeatures that the env method doesn't have, and
it improves on it in important ways.

This doesn't really touch zsh except that we could do it in our own
#! handler (see zexecve() in Src/exec.c).

(Follow-ups should probably go to zsh-workers).

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



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