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

Re: ${path[@]} in sh mode [was: Segfault with zsh 5.2]



On Fri, 22 Jan 2016 17:53:01 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Jan 23,  1:08am, Martijn Dekker wrote:
> }
> } > If you're in a function context, you can say 'typeset -h path' to hide
> } > the specialness of $path and declare a new local of the same name. Eg,
> } > one that isn't connected to PATH.
> } 
> } It would be nice if that worked globally too, and even nicer if it were
> } automatically done by 'emulate sh' (or ksh for that matter) and undone
> } by 'emulate zsh'. But that might be non-trivial and the developers may
> } have other priorities.
> 
> It's non-trivial.  The emulate command only deals with setopts, not with
> keywords, parameters, etc.

One minor bonus worth nothing is that you don't need to use the "-h" in
the function.  You can tell the special itself that it's to be hidden by
a local:

% typeset -h path
% foo() { integer path=43; print ${(t)path}; }
% foo
integer-local
% print ${(t)path}
array-unique-hide-special

pws



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