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

Re: f() { local -ar path=(/bin); };f gives an error



On 11/26/2017 06:21 PM, Stephane Chazelas wrote:
> FYI,
> 
> someone reported this on unix.stackexchange.com:
> https://unix.stackexchange.com/questions/407125/why-cant-i-define-a-readonly-variable-named-path-in-zsh
> 
> Which looks like a bug:
> 
> $ zsh -c 'f() { local -ar path=(/bin); }; f'
> f: read-only variable: path
> $ /zsh --version
> zsh 5.4.2-dev-0 (x86_64-unknown-linux-gnu)
> 
> See also the answer there by someone would did some investigation already.
> 
() { local -har path=(/foo); typeset -p path }
typeset -ar path=( /foo )

-h     Hide: only useful for special  parameters  (those  marked
       `<S>' in the table in zshparam(1)), and for local parame‐
       ters with the same name as a  special  parameter...



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