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

Re: Bug with sh emulation; shouldn't KSH_TYPESET be set?



On Mon, Jan 30, 2012 at 10:43 PM, Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:
> Felipe Contreras wrote:
> [...]
>>       local t=$(echo foo --bar)
> [...]
>> But not in zsh, with sh emulation. Enabling KSH_TYPESET makes it work.
>>
>> Shouldn't it be enabled with sh emulation?
>>
>> BTW. What exactly is 'emulate sh' supposed to emulate? I would like to
>> run that shell to check for compatibility issues, and apparently it's
>> not bash.
>
> "emulate sh" is POSIX shell emulation (we did amend this mode in the
> past to work as much as possible as POSIX describes). Neither typeset
> nor local are part of POSIX (at least not SUSv3 - I don't know about
> v4).
>
> So, I don't think it should be enabled.

But it wouldn't hurt either, right? It would be nice to have some
'bash' emulation mode, but since there isn't any, why not enable this
harmless option?

> FWIW, dash and posh behave like zsh's sh-mode here. Ksh93 doesn't work
> at all, because it has no `local' (only typeset). Mksh, pdksh and bash
> work like KSH_TYPESET was set in zsh.

Hmm, I see, but there's no bash emulation mode =/

I guess it's time to compare the differences between ksh and sh
emulation to see which is closer.

-- 
Felipe Contreras



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