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

Re: zsh portable script



Le 20 juil. 2010 à 15:53, Thorsten Kampe a écrit :

> * Joke de Buhr (Mon, 12 Jul 2010 17:37:19 +0200)
>> On Monday 12 July 2010 16:46:22 Atom Smasher 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?
>> 
>> Using env doesn't solve the problem either. There is no guarantee the "env" 
>> program is installed under /usr/bin/env.
> 
> It does solve the problem that's why it's used in (shell) scripting[1]. 

No it does not.
BeOS never had any /usr.
Haiku doesn't either.

It's just used because people "saw" env being put there more often than python or perl of whatever, but it doesn't mean they looked to all possible places.
It has just more chances of working but it's not a guarantee.

> For Python for example it's the official way to specify the interpreter. 

Being official doesn't mean it's correct or works.

> I don't think "Atom Smasher" need a "guarantee" - just a confirmation 
> that it does indeed work.

Again, it won't on Haiku and likely others.

François.


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