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

Re: [[ is being treated as a pattern in the command/reserved word position.

On 03/28/2015 07:57 PM, ZyX wrote:
> There is also another consideration: POSIX does not define `[[`. So
> when you run an emulation mode *what exactly* should `[[` do? When
> emulating `bash` (not present for some reason) or `ksh` this is
> defined by those shells, but `sh` is clearly not a bash emulation
> (reasoning: BASH_REMATCH is not set) and not ksh emulation (reasoning:
> `emulate ksh` is a distinct emulation mode and `sh` emulation mode is
> not referenced as an alias of `ksh` emulation mode). I have failed to
> find what zsh developers meant by `sh` emulation exactly though: it is
> not explicitly said that it emulates POSIX shell. But since it not
> bash or ksh emulation mode `[[ $w ]]` in the above case should be
> `false` (busybox emulation) or a command-not-found error (posh or dash
> emulation). 
From my understanding of emulate, it works similar to bash's posix mode.
Changing anything that conflicts with the mode, but doesn't disable
other non-conflicting extensions.

Distros like Arch Linux relies on it to source their /etc/profile from
the global zprofile is more sh like environment.
(with the added perk of stuff like [[ working.)
I've also been using it for stuff like that for a long time and would
appreciate it staying the way it currently is.

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