Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Portable zsh scripts
- X-seq: zsh-users 12645
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Portable zsh scripts
- Date: Wed, 27 Feb 2008 14:38:09 +0100
- In-reply-to: <200802271252.m1RCq6wd009231@xxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <fq3lhr$fgj$1@xxxxxxxxxxxxx> <200802271252.m1RCq6wd009231@xxxxxxxxxxxxxx>
On 2008-02-27 12:52:06 +0000, Peter Stephenson wrote:
> Thorsten Kampe wrote:
> > I'm starting all my zsh scripts with...
> >
> > #! /bin/zsh -f
> > emulate -R zsh
> >
> > ...in order to minimize any problems that might occur because other
> > systems have other zsh options set.
/bin/zsh is definetely not portable. I use:
#!/usr/bin/env zsh
(with the drawback that zsh options can't be used).
> The -L flag is only useful in functions; in a script you're starting
> a fresh shell so making the changes local to it isn't meaningful.
As some scripts can also be used as functions, it may be a good idea
to use "emulate -LR zsh" every time. This is what I do. And instead
of "exit <value>", I use "return <value>".
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author