Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh handling of non-standard if-evaluations
- X-seq: zsh-users 11166
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: zsh handling of non-standard if-evaluations
- Date: Wed, 31 Jan 2007 17:23:25 +0000
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <070131075124.ZM15434@xxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <184104.7951.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <070128120533.ZM730@xxxxxxxxxxxxxxxxxxxxxx> <20070128201040.GA4908@xxxxxxxxxxxxxxx> <070128122451.ZM805@xxxxxxxxxxxxxxxxxxxxxx> <20070129004105.GA4623@xxxxxxxxxxxxxxx> <070131075124.ZM15434@xxxxxxxxxxxxxxxxxxxxxx>
- Sender: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
On Wed, Jan 31, 2007 at 07:51:24AM -0800, Bart Schaefer wrote:
> On Jan 29, 12:41am, Stephane Chazelas wrote:
> }
> } > > load-sh-profile() {
> } > > emulate -L sh
> } > > . /etc/profile
> } > > }
> } >
> } > No: any "typeset" commands would create parameters that are local to the
> } > load-sh-profile function; that may have undesired consequences.
> }
> } typeset is not sh, so there wouldn't be any in /etc/profile.
>
> By that logic, [ "$VAR" == "VAL" ] is not sh either, so the original
> problem should not exist. If there is one bash-ism in /etc/profile,
> then one might expect that there are others.
That's true. But on the other hand, it's often better not to
accomodate for bugs especially when they are easy to fix, as it
helps detecting them.
Using [ ... == ... ] or typeset in /etc/profile is a bug.
/etc/profile is meant to be read by all the POSIX conformant
shells (and Bourne shells AAMOF) so has to be Bourne compatible
(not only POSIX) (except maybe if you can guarantee that the
Bourne shell won't ever be installed on your system by any of
your users).
On the other hand I think both our solutions fail if
/etc/profile contains something like
set -u
or
set -C
which are valid Bourne syntax.
In anycase, there's no much point using typeset or set or
non-Bourne syntax in /etc/profile (though you sometimes find
things like export var=value which is not Bourne and interpreted
differently by bash/ksh/pdksh/zsh).
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author