Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] sh/ksh init: don't initialise lowercase parameters
On Tue, 2020-01-28 at 16:19 +0100, Martijn Dekker wrote:
> In POSIX sh and in ksh, it's the convention that lowercase variable
> names are reserved for scripts, and uppercase names may be used by the
> shell or system. So most lowercase zsh parameters are not initialised
> when zsh is invoked as sh or ksh (through a symlink or the --emulate
> option).
>
> However, there are two left that are initialised in sh/ksh mode:
> 'histchars' and 'signals'. So this can conflict with POSIX scripts.
>
> Also, if zsh is invoked as sh or ksh, 'histchars' is available whereas
> the 'HISTCHARS' equivalent is not. It seems quite obvious that this
> should be the other way around.
>
> The attached patch makes zsh, when invoked as sh or ksh, not initialise
> 'signals', and initialise 'HISTCHARS' instead of 'histchars'. It also
> updates the documentation.
That sounds fine to me --- as you know, general policy has always been
that emulation modes are there solely for compatibility with other
shells and backward compatibility is irrelevant, whereas native mode
is the other way round.
I'm guessing histchars got that way round in some kind of mistaken
link up with compatibility with csh, which tends to deal only
with lower case variables. But that's just a guess, don't think
it really matters.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author