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

Re: more dependencies on emulation

On Jul 18,  3:23pm, Zefram wrote:
> Subject: more dependencies on emulation
> There are two distinct uses of emulation addressed here.  One affects
> the position of filename expansion in the order of expansion; I add a
> new option, SH_FILE_SUBST, to control this.  [...]
> The second use of emulation is to control whether the $foo[2] subscript
> placement will work; sh and ksh don't recognise it as a subscript.
> The patch makes this be controlled by the KSH_ARRAYS option, as it should
> have been all along.  The KSH_ARRAYS option is also changed to be set
> by default when emulating sh, which was previously not essential.


>       + \fBSH_FILE_SUBST\fP
>       + If this option is unset, it is performed
>       + .I after
>       + brace expansion, so things like ``~$USERNAME'' ``~{pfalstad,rc}'' will work.

Two minor nits:

If zsh were really emulating sh, arrays wouldn't work at all.  So it's a
bit dubious to force ksh syntax only, given that it affects the indices
as well as the syntax.

I don't have a ksh to try this, but ~{pfalstad,rc} works fine in Bash
(that is, the ~ is expanded), even though ~$USER doesn't expand tilde.
In zsh's ksh emulation mode with this patch applied, ~$USER works, but
~{pfalstad,rc} fails unless IGNORE_BRACES is also unset.  There doesn't
seem to be any way to get the Bash behavior (maybe not important), but
the manual should probably mention the IGNORE_BRACES requirement if it
is going to use ~{...} in this example.

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